How to resolve "Unrecognised function or variable" when using LOAD function ? ( GUIDE)

5 ビュー (過去 30 日間)
Teo Say Yee
Teo Say Yee 2021 年 3 月 18 日
コメント済み: Rik 2021 年 3 月 18 日
load ('rawsource.mat');
a = get(handles.popupmenu4,'Value');
switch a
case 1
sound (MaryHadAlittleLamb,fs);
case 2
sound (TwinkleTwinkleLittleStar,fs);
otherwise
sound (OldMacDonald,fs);
end
So I loaded a .mat file into the workplace and for some reason, variable TTLS and OMD were not regconised by MATLAB but MHALL was able to be sounded as expected. This is a callback codes for popupmenu that when user selects their choice, the selected song will play. I have also ensured that there are no typos. Also, the variable TTLS and OMD were also appearing in .mat file as expected. How can I solve this problem ?
Unrecognized function or variable 'TwinkleTwinkleLittleStar'.
Error in testing202>popupmenu4_Callback (line 449)
sound (TwinkleTwinkleLittleStar,fs);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in testing202 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)testing202('popupmenu4_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
  3 件のコメント
Teo Say Yee
Teo Say Yee 2021 年 3 月 18 日
@Walter Roberson I did put whos after load and those variables were not in it. So I manually saved and overwrited the old .mat file. and now it is working. Problem Solved ! Thank you very much
Rik
Rik 2021 年 3 月 18 日
In addition to Walter's remarks:
You should always load to a struct. That way it is immediately obvious where variables are coming from.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio I/O and Waveform Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by