To transfer datas among the GUIs

1 回表示 (過去 30 日間)
Debashis Panda
Debashis Panda 2016 年 12 月 29 日
編集済み: Debashis Panda 2016 年 12 月 31 日
Hello every one; I have created a main UI having a popup menu that contains circle,Rectangle and Triangle.If user will clicks circle (then another ui will open,there user will enter the value of radius and this value will transfer to main ui) elseif user will click rectangle (then rectangle ui will open,there user will enter the value of length and breadth, and these values will come to the main ui) else if user will click Triangle (then triangle ui will open there user will enter the value of length and height, and these values will return to main ui),after this area and perimeter will be calculated and result will be displayed in main ui. I have written the following code for this but i am getting error message please any
name =get(handles.geo,Value) % geo is the tag of popup menu geometry(circle,rectangle,triangle)
if name==1
cirlce;% open first UI(circle)
elseif name==2
rectangle;%Open secnd UI(Rectangle)
elseif name==3
triangle;%Open third UI(Triangle)
end
if name==1
r=getappdata(0,Variable1) % get the value of radius from circle UI
area=pi*r*r;
perm=2*pt*r;
elseif name==2
data=getappdata(0,variable2)% get the value of length and breadth from rectangle
l=data(1);% length of rectangle first value of data
b=data(2);% breadth of rectangle second value of data
area=l*b;
perm=2*(l*b);
elseif name==3
% same like previous
end
% send the values to edit text area and perm in main UI.
But while running the code main UI is opening, after clicking popup menu (for example 1 i.e. circle) circle UI is opening and an error message is coming r=[]. it is not calculating area and perimeter. any one please suggest how to do it. sryfor bad english.Thanks in advance...
  1 件のコメント
Image Analyst
Image Analyst 2016 年 12 月 30 日
It looks like you misspelled circle as "cirlce" Make sure your spelling is consistent and correct.
If that's not the problem, then post your error message. That means ALL the red text , not just part of it.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2016 年 12 月 29 日
You probably want
r=getappdata(0,'Variable1') % get the value of radius from circle UI
as the second parameter to getappdata is a string.
  9 件のコメント
Walter Roberson
Walter Roberson 2016 年 12 月 30 日
Does your code for circle uiwait() or waitfor() to prevent the main routine from continuing until the data is entered? It needs to wait for the input. Or you could code the call as
uiwait(circle1())
Debashis Panda
Debashis Panda 2016 年 12 月 31 日
編集済み: Debashis Panda 2016 年 12 月 31 日
Thnak you sir, it is the correct answer wish you a happy new year.....

サインインしてコメントする。

その他の回答 (1 件)

adi kul
adi kul 2016 年 12 月 29 日
編集済み: adi kul 2016 年 12 月 29 日
try using
setappdata
instead! Getappdata returns values while setappdata stores it. More information:
  1 件のコメント
Debashis Panda
Debashis Panda 2016 年 12 月 29 日
Dear adi, thanks for your quick replay but i have already used setappdata (in UI circle,rectangle and triangle) to transfer the values to main UI. But before the values are returned to main UI, it is displaying error message (r=[] , data=[], l=[],b=[]).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by