How to deal with gui's and handles in .m
1 回表示 (過去 30 日間)
古いコメントを表示
Basically from a gui i run with a function a .m file that contains a for cycle. Let's suppose that this cycle has 2 iterations. At the end of the first iteration i'd like to display in the gui the percentual of the routine, therefore have an output in the gui.
This is the part of the code that i have at the end of the for cycle in the .m file of the function
compl=(index/num_repetitions)*100;
assignin('base','compl',compl)
compl = evalin('base', 'compl');
handles=guidata(handles.percentual);
set(handles.percentual,'String',compl);
While this is the error i obtain
??? Undefined function or variable "handles".
Error in ==> sim_main_part2 at 138 handles=guidata(handles.percentual);
Error in ==> GUI>simulate_Callback at 237 [y]=sim_main_part2(ll, dz, stDdz, z, teta, Const_x, Const_y, PixScale, num_repetitions);
What should i do to make it work? Thank you for any help
0 件のコメント
回答 (2 件)
Doug Hull
2013 年 11 月 11 日
This line of code does not make much sense
handles=guidata(handles.percentual);
It is unclear what it should be out of context, but watch the video and you should be fine.
Image Analyst
2013 年 11 月 11 日
You called sim_main_part2() but didn't pass in handles. Since it's not a GUIDE-generated callback, it does not automatically have handles in the private, local workspace of the sim_main_part2() function. If you want to use handles in that function, you will have to pass it in, and list it as an argument in the function declaration line:
function y = sim_main_part2(handles, ll, dz, stDdz, z, teta, Const_x, Const_y, PixScale, num_repetitions)
% Code goes here...
If you change handles, you can pass it out also:
function [handles, y] = sim_main_part2(handles, ll, dz, stDdz, z, teta, Const_x, Const_y, PixScale, num_repetitions)
% Code goes here...
15 件のコメント
Image Analyst
2013 年 11 月 18 日
You can attach files here. I don't take files via email. But I give no guarantee that I'll have time to look at them.
参考
カテゴリ
Help Center および File Exchange で String Parsing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!