フィルターのクリア

creating a variable address

6 ビュー (過去 30 日間)
Amir amini
Amir amini 2020 年 2 月 8 日
コメント済み: Stephen23 2020 年 2 月 8 日
I linked Matlab software with a engineering software. MATLAB software must generate a new address every time it can be used in engineering software. The general format of the addresses in the engineering software is as follows:
A.Application.Tree.FindNode('Data\Blocks\variable component\Input\MODEL_TYPE').value
that 'variable component' change every time and When this changes; The address also changes with it.
How can I creat a variable address?
is below code correct?
for i=3:size(strtbl,2)
val_type(i)=sprintf('''A.Application.Tree.FindNode(''\Data\Blocks\%s\Input\MODEL_TYPE'')''',strtbl(3,i));
end
matlab response:
Function is not defined for 'cell' inputs.
Error in Program (line 42)
val_type(i)=sprintf('''A.Application.Tree.FindNode(''\Data\Blocks\%s\Input\MODEL_TYPE'')''',strtbl(3,i));

採用された回答

Giuseppe Inghilterra
Giuseppe Inghilterra 2020 年 2 月 8 日
Hi,
i recommend you to use "fullfile" matlab function. This function allows you to build addresses from parts.
Thus, in your case:
variablecomponent = 'text';
fullfile('Data','Blocks',variablecomponent,'Input','MODEL_TYPE');
Thus, you vary in your for loop variablecomponent and you obtain a variable address.
Note that if variablecomponent is a cell array, where each cell contains a character array, remember to use {} brackets in your for loop. Otherwise the output of fullfile function is not a character array, but a cell array and maybe your function 'A.Application.Tree.FindNode' does not accept a cell array as input argument.
Hope this helps.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by