How to import data in MATLAB?
We already discussed how to import data using the right-mouse click and Import Wizard. The same way, we can use the function UI-Import. It's providing the same functionality, only with the difference that we can call it as a MATLAB function, choosing the MATLAB file and do exactly the same that we did just with the right-mouse click. Now we have the data inside.
How to use Variable Editor?
So, if I double-click on the data, I can see all the data available in the variable editor. And now if I try to pull out all the data, I see that the graphics is kind of not really nice-looking. Why is that? In MATLAB the data will be plotted column-wise not row-wise. So, that's why we have this data-set in the column one and then in the column two, three, five and so on. It does not look so nice as you see. How can we change it?
How to plot rows versa columns?
We can change it by plotting the data in another way. We can plot it using the function plot and we can transpose the data. So, the data will be seen as two columns, and then we can plot it. So just to show you what these two columns are, let's see that. I call it “my_data”; is equal to data transposed. And now we see that we get two columns, right? So, if I double-click on “my_data”, we have two columns. We can choose all the data and plot it and then we have exactly the same view as we want. So, this is pretty nice and now we see that MATLAB works column-wise and not row-wise.
How to enhance the plots with legends and markers?
So, let's discuss what we can do with this graph. In our case, we want to have some kind of name over here. We want to have names for axis y and for axis x. And we want some kind of a nice way to show all these dots over here to have markers for all the data because the data is basically interpolated. So, all the dots that we have in the data are just connected with the line. So, we want to see all the markers in there. And we want to see the legends for both this and the other graphs saying something like this is the “measurement point one” and “measurement point two”. So, let's do that. The easiest way of doing this is to use the plot tools provided with MATLAB…
Please note: this is a short transcript of the training video above.