data sharing between two GUI and with in a GUI

조회 수: 1 (최근 30일)
phani
phani 2011년 7월 15일
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에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by