Reference to non-existent field 'recording'.

This is my code
question_6 = load('recording.mat');
time = question_6.recording.X.Data
and this is what my command window looks like when i run it:
Reference to non-existent field 'recording'.
Error in lab_9_script (line 11)
time = question_6.recording.X.Data
I made sure my .mat that i am calling is named like that and they are all in the same folder yet for some reason it says it does not exist?

5 件のコメント

Walter Roberson
Walter Roberson 2020 年 11 月 25 日
what shows up for
whos -file recording.mat
Image Analyst
Image Analyst 2020 年 11 月 25 日
Take the semicolon off that line and see what it reports to the command window.
question_6 = load('recording.mat')
Paola Quintana
Paola Quintana 2020 年 11 月 25 日
it does not show anything
Image Analyst
Image Analyst 2020 年 11 月 25 日
編集済み: Image Analyst 2020 年 11 月 25 日
Try again. If you get to the time line, it will have to get past the load() line, and if you leave off the semicolon it must show something in the command line.
Paola Quintana
Paola Quintana 2020 年 11 月 25 日
it was saving as something else. I renamed it but in the workspace it was called diffrently. Thank you!

回答 (1 件)

per isakson
per isakson 2020 年 11 月 25 日
編集済み: per isakson 2020 年 11 月 25 日

0 投票

%%
clearvars
a=1; b=2; X.data = 17;
save( 'recording.mat' );
%%
question_6 = load('recording.mat')
outputs
question_6 =
struct with fields:
X: [1×1 struct]
a: 1
b: 2
>>
Conclusion. There is no field named recording
Try
time = question_6.X.Data
ans =
17
>>

この質問は閉じられています。

質問済み:

2020 年 11 月 25 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by