MATLAB: Plotting .mat file……

problem plotting in .mat file

Hi, I want to plot from spectrum.mat file but it giving me following error. Error using plot Invalid first data argument. Error in data (line 5) plot('spectrum.mat')
But when I exactly load this file then it loading and at right in 'workspace box' giving "spec 401×2 double" values.
Could anyone please let me know that why I can't plot this "spectrum.mat" file, kindly if someone show me the procedure for plotting .mat files. By the way in this spectrum.mat file there are two columns (e.g x-axis Frequency and y-axis Scale) and 401 rows.
Thanks

Best Answer

"plot('spectrum.mat')"?! This tries to plot the char vector 'spectrum.mat'.
You cannot plot a file. You have to load the data at first:
Data = load('spectrum.mat');
Now you can plot the data, perhaps by:
plot(Data.spec)
Or
plot(Data.spec(:,1), Data.spec(:,2))