data sharing between two GUI and with in a GUI

1 view (last 30 days)
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.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 15 Jul 2011
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 Comments
Walter Roberson
Walter Roberson on 15 Jul 2011
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 on 16 Jul 2011
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

Sign in to comment.

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!