Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Execute command syntax

3 ビュー (過去 30 日間)
K Kallerhoff
K Kallerhoff 2012 年 6 月 18 日
コメント済み: Stephen23 2022 年 1 月 1 日
Hi, I need to change a value with and execute command like this
value = 1;
Execute(handles.server, 'test.a(1)=value')
but is only works, if the you type a number instead of value like this
Execute(handles.server, 'test.a(1)=1')
any suggestions?
Thanks Kay
  1 件のコメント
Stephen23
Stephen23 2022 年 1 月 1 日
"any suggestions?"
Call PutWorkspaceData first, as the Execute examples show:

回答 (1 件)

Voss
Voss 2021 年 12 月 31 日
The character array 'test.a(1)=value' contains the word 'value' rather than the value of the variable "value". You can use sprintf() to get a variable number into a character array:
value = 1;
Execute(handles.server, sprintf('test.a(1)=%d',value))

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by