Plot signal from list of data in MATLAB

AI Thread Summary
To plot a signal from a .mat file in MATLAB, the user needs to load the data using the 'load' command. The code attempts to extract the size of the loaded data, but it incorrectly uses 'size' on the filename instead of the actual data variable. A proper approach involves creating an x vector that matches the length of the y-data for plotting. The user also seeks assistance with loading the .mat file correctly and using a GUI to select the .m file for execution. Clarifying the data variable after loading the .mat file is essential for successful plotting.
kay310
Messages
8
Reaction score
0
I want to load a .mat file which contain 500 column of data in it and plot the signal out through the GUI using .m file.
Can anyone help me on the code?
 
Physics news on Phys.org
So you have a set of y-data of 300. Make an x vector of size 300 that goes from 0 to 300 and then plot(x,y);
 
I'm now actually unable to load the .mat file using 'load' command.
I doing this way in m-file:

load filename;
[x,y] = size(filename);
t = 1:y;
plot(t, filename);

%the filename is in .mat format
 
can anyone help me in load a .m file and plot the signal out?

using this way:
[Filename, PathName] = uigetfile('*.m','Select the M-file');
 

Similar threads

Replies
1
Views
2K
Replies
8
Views
2K
Replies
8
Views
1K
Replies
6
Views
5K
Replies
10
Views
2K
Replies
7
Views
1K
Replies
6
Views
1K
Back
Top