plotting .mat file......
83 次查看(过去 30 天)
显示 更早的评论
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 401x2 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
0 个评论
采纳的回答
Jan
2017-4-26
"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))
7 个评论
Walter Roberson
2020-10-5
Yes, the x2 indicates two columns. This is standard output format for "whos", the dimension sizes separated by 'x'
You do appear to have 200 columns.
You can use that syntax, provided that the name of the saved variable is spec and you assign the result of load() to the variable named Data
However, I suspect that would be the wrong thing to do. I suspect that you have either 4853 stress sites sampled at 200 times, or else 200 stress sites sampled at 4853 times. I suspect you should use something more like a waterfall plot.
Nawsheen Tarannum Promy
2020-10-22
Hi, I'm using 3 variables and it gives me error saying tabular/plot and tells me to use stackedplot function. Can you help me with this?
更多回答(1 个)
Moiz Tariq
2018-12-5
编辑:Moiz Tariq
2018-12-5
See tthe name of file in workspace
let's say the name is wwe
write in comand window
[load'wwe.mat'
x=wwe(:, 1)
y=wwe(:,2)
plot(x,y)]
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Encryption / Cryptography 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!