フィルターのクリア

Passing array between GUI callbacks

1 回表示 (過去 30 日間)
Harryboy
Harryboy 2019 年 12 月 9 日
コメント済み: Harryboy 2019 年 12 月 9 日
Between two push button callbacks I am trying to share two arrays. I check:
but I do not understand it so well. One array is of type of double and the other is complex. Both the arrays are same size. How do I do this?
I am not able to get it done with getappdata and setappdata commands.

採用された回答

Rik
Rik 2019 年 12 月 9 日
This is in broad strokes how you can use getappdata and setappdata.
h_fig=figure;
%in your startup/constructor function:
A=[];%initialize to empty array
B=complex([]);%init to empty complex array
setappdata(h_fig,'ArrayToBeShared1',A)
setappdata(h_fig,'ArrayToBeShared2',B)
%in functions 1 and 2:
A=getappdata(h_fig,'ArrayToBeShared1');
B=getappdata(h_fig,'ArrayToBeShared2');
if isempty(A)
end
if isempty(B)
end
%
%rest of your function
%
setappdata(h_fig,'ArrayToBeShared1',A)
setappdata(h_fig,'ArrayToBeShared2',B)
If you have any issues implementing this, please post a specific example of what you have tried and how the behavior deviated from what you expected.
  1 件のコメント
Harryboy
Harryboy 2019 年 12 月 9 日
Thank you, working solution!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by