コードにサブルーチンがあり、ユーザーが分析の種類を選択するための GUI を作成します。
%% Gives user the choice of replacement method
figure('Units','Normalized','Color','w','Position',[.3 .6 .4 .15],...
'NumberTitle','off','Name','Analysis choice','MenuBar','none');
uicontrol('Style','text','Units','Normalized',...
'Position',[.1 .7 .8 .2],'BackgroundColor','w','String','What replacement method do you want to use?');
uicontrol('Style','pushbutton','Units','Normalized',...
'Position',[.05 .3 .3 .3],'String','Cubic interpolation 24 points',...
'CallBack','cubic_choice'); % cubic_choice.m rotine must be on current folder
uicontrol('Style','pushbutton','Units','Normalized',...
'Position',[.4 .3 .3 .3],'String','Last good data value',...
'CallBack','lgv_choice'); % lgv_choice.m rotine must be on current folder
uicontrol('Style','pushbutton','Units','Normalized',...
'Position',[.75 .3 .2 .3],'String','Linear interpolation',...
'CallBack','li_choice'); % li_choice.m rotine must be on current folder
uiwait;
close;
さらにコードには、ユーザーが行った選択を分析する if ループがあります。
if strcmp(inp,'cubic') ...
問題は、[3 次補間 24 ポイント] ボタンを押したときに、コールバック関数が変数を与えないことですinp
。つまり、変数がワークスペースに表示されません。コールバック関数は次のようなものです。
%% Callback script for replacement method
% Cubic interpolation with 24 points method
function [inp] = cubic_choice
inp = 'cubic';
uiresume(gcbf); % resumes the button call
私はおそらく setappdata と getappdata を使用する必要があることを知っています。これは、他のスレッドで既に読んでいるが、動作させることができないためです。
誰でも私を助けることができますか?
前もって感謝します。
よろしく、 ペドロ・サンチェス