data sharing between two GUI and with in a GUI

1 次查看(过去 30 天)
hi everyone, i am using a main GUI and a sub GUI and i created them using GUIDE. i want to pass variables from the main GUI to sub GUI and i made it using setappdata and getappdata. the code is as shown below:
setappdata(0,'sampfreq',fs);
i am able to transfer the "fs" value to the sub GUI but in the sub GUI when i am using handles to share the data with in the second GUI it is showing the error as shown below.
code:
set(handles.pp_val,'string',num2str(m));
i am using this command to display some value in the static text box.
the error i am getting is :
?? Attempt to reference field of non-structure array.
Error in ==> tr4>pbacquire_Callback at 87 set(handles.pp_val,'string',num2str(m));
can any one please suggest me to get rid of the above stated problem. please help me as i am struggling with this problem from last two weeks. please help me, thanks in advance.

回答(1 个)

Fangjun Jiang
Fangjun Jiang 2011-7-15
Put a break point at this line and run your code, check what is the value of handles.pp_val, can you run the following command in the MATLAB command window:
get(handles.pp_val)
  3 个评论
Walter Roberson
Walter Roberson 2011-7-15
That particular error would occur if handles was not a structure at all, so checking with get(handles.pp_val) would fail. class(handles) would show you what type of thing handles is.
phani
phani 2011-7-16
thanks walter, i kept a break point at the command
set(handles.pp_val,'string',num2str(m));
and when i used class(handles) it displays
K>> class(handles)
ans =
double

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by