guideでワークスペースの変数を使用する方法について
Mostra commenti meno recenti
現在、ワークスペースで読み取ったデータをボタンプッシュで更新できるようにプログラムを作成したいです。 sin波で上図に元波形、下図に更新した波形が表示されるようにまではできたのですが、gideでワークスペースのデータを使用するにはどうしたらいいのかがわかりませんでした。
初歩的な質問かもしれませんが、ご教示いただけると幸いです。
よろしくお願いいたします。
function buttonPlot
% Create a UI figure window
fig = uifigure('Name','checking cutout start time');
% Create a EMG axses1
ax1 = uiaxes('Parent',fig,... 'Units','pixels',... 'Position',[50, 220, 400, 200]);
% Create a UI axses2
ax2 = uiaxes('Parent',fig,... 'Units','pixels',... 'Position',[50, 20, 400, 200]);
% Create a push button
btn = uibutton(fig,'push',... 'Text','update',... 'Position',[460, 120, 100, 20],... 'ButtonPushedFcn',@(btn,event) plotButtonPushed(btn,ax2));
% Create a wave
x = linspace(0,2*pi,100); y = sin(x)*rand; plot(ax1, x, y,'k'); end
%Create the function for the ButtonPushedFcn callback
function plotButtonPushed(btn,ax2) x = linspace(0,2*pi,100); y = sin(x)*rand; plot(ax2, x, y,'k');
end
1 Commento
Try of translation:
About how to use workspace variables in Guide
Currently I would like to create a program so that I can update data read by workspace with button push. Although it was possible to display the original waveform in the upper figure above and the updated waveform in the lower figure with the sin wave, I did not know how to use workspace data with gide.
Although it may be an elementary question, I would be pleased if you could teach.
Thank you.
function buttonPlot
% Create a UI figure window
fig = uifigure('Name','checking cutout start time');
% Create a EMG axses1
ax1 = uiaxes('Parent',fig,... 'Units','pixels',... 'Position',[50, 220, 400, 200]);
% Create a UI axses2
ax2 = uiaxes('Parent',fig,... 'Units','pixels',... 'Position',[50, 20, 400, 200]);
% Create a push button
btn = uibutton(fig,'push',... 'Text','update',... 'Position',[460, 120, 100, 20],... 'ButtonPushedFcn',@(btn,event)
plotButtonPushed(btn,ax2));
% Create a wave
x = linspace(0,2*pi,100);
y = sin(x)*rand;
plot(ax1, x, y,'k');
end
%Create the function for the ButtonPushedFcn callback
function plotButtonPushed(btn,ax2)
x = linspace(0,2*pi,100);
y = sin(x)*rand;
plot(ax2, x, y,'k');
end
Risposta accettata
Più risposte (1)
Ryosuke Takahashi
il 23 Ott 2018
0 voti
Categorie
Scopri di più su Spline Postprocessing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!