フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Passing value from one function to another function in the same .m file

3 ビュー (過去 30 日間)
Wong Wei Weng
Wong Wei Weng 2018 年 7 月 14 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
function Check_Callback(hObject, eventdata, handles)
blah = get(handles.Option,'SelectedObject');
blah = get(blah,'String');
leaf1 = 'Parsley';
leaf2 = 'Coriander';
tf = strcmp(blah,leaf1);
tf2 = strcmp(blah,leaf2);
result1 = 'You are right, it is a parsley leaf';
result2 = 'You are right, it is a coriander leaf';
result3 = 'You are wrong, it is a parsley leaf';
result4 = 'You are wrong, it is a coriander leaf';
if (G <= 200 && tf == 1)
set(handles.text3, 'String', result1);
else if (G > 200 && tf1 == 1)
set(handles.text3, 'String', result2);
else if (G <= 200 && tf1 == 0)
set(handles.text3, 'String', result3);
else if (G > 200 && tf1 == 0)
set(handles.text3, 'String', result4);
end
end
end
end
set(handles.Analyze,'Enable','on')
function Upload_Callback(hObject, eventdata, handles)
[a, b]=uigetfile ({'*.*', 'All files'});
img=imread(fullfile ([b a]));
imshow (img, 'Parent', handles.QueryImage);
set(handles.Analyze,'Enable','off');
  1 件のコメント
Stephen23
Stephen23 2018 年 7 月 14 日
If you are using GUIDE then use guidata. If you are sensibly writing your own code then use nested functions. Both of these are explained in the documentation:

回答 (0 件)

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

Community Treasure Hunt

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

Start Hunting!

Translated by