plotting .mat file......

조회 수: 82 (최근 30일)
Murtaza Ali Khan
Murtaza Ali Khan 2017년 4월 26일
댓글: Nawsheen Tarannum Promy 2020년 10월 22일
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

채택된 답변

Jan
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
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
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
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)]

카테고리

Help CenterFile Exchange에서 Encryption / Cryptography에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by