set_paramコ​マンドで、Selec​torとAssign​mentブロックのパ​ラメーター {入力/出力の次元数​(NumberOfD​imensions)​} を設定する方法を教えてくれませんか?

set_paramコマンドで、SelectorとAssignmentブロックのパラメーター {入力/出力の次元数(NumberOfDimensions)} を設定すると下記エラーメッセージが表示されます。
>> set_param(gcb,'NumberOfDimensions','1')
TEST/Assignment' で指定されたパラメーター 'IndexOptions' は、2 の次元に対してインデックス オプションが与えられています。これは入力の次元数 1 と一致しません。

 Accepted Answer

Assignmentブロック、Selector ブロックの次元の変更についてですが、次元の変更とともに、それに伴う 「インデックスオプション」,「インデックス」,「出力サイズ」といったプロパティについても、 2次元分の設定を明示的に行う必要がございます。
下記は、Selector ブロックの例になります。
・NumberOfDimensions を 1 にする場合、
S = 'untitled/Selector';
set_param(S,...
'NumberOfDimensions','1',...
'IndexOptions','Index vector (dialog)',...
'IndexOptionArray',{'Index vector (dialog)'},...
'IndexParamArray',{'[1 3]'},...
'OutputSizeArray',{'1'},...
'Indices', '[1 3]',...
'OutputSizes','1');
・NumberOfDimensions を 2 にする場合、
S = 'untitled/Selector';
set_param(S,...
'NumberOfDimensions','2',...
'IndexOptions','Index vector (dialog),Index vector (dialog)',...
'IndexOptionArray',{'Index vector (dialog)';'Index vector (dialog)'},...
'IndexParamArray',{'[1 3]';'1'},...
'OutputSizeArray',{'1'; '1'},...
'Indices', '[1 3],1',...
'OutputSizes','1,1');

More Answers (0)

Categories

Products

Release

R2019a

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!