set_param 'Table' datatype
6 views (last 30 days)
Show older comments
Ubaldo
on 1 Aug 2016
Commented: Georgia - Eirini Lazaridou
on 23 May 2023
Hi all. I cannot set the 'Table" by using set_param
my_data = [1 1 1 1];
set_param(char(my_table),'Table',my_data)
Invalid setting in Lookup_n-D block 'table_xyz' for parameter 'Table'
my_data = [1 1 1 1];
set_param(char(my_table),'Table',num2str(my_data))
Parameter 'Table' setting: "1 1 1 1" cannot be evaluated.
Caused by:
Error: Unexpected MATLAB expression.
my_data = [1 1 1 1];
set_param(char(my_table),'Table',{my_data})
Invalid setting in Lookup_n-D block 'table_xyz' for parameter 'Table'
On the other hand, by using numerical value, e.g.
my_data = [1 1 1 1];
set_param(char(my_table),'Table','[1 1 1 1]')
It works. any thoughts?
0 Comments
Accepted Answer
Guillaume
on 1 Aug 2016
Assuming mydata is a row vector, this should work:
assert(isrow(mydata), 'data is not row vector');
set_param(char(my_table), 'Table', ['[', num2str(mydata), ']']);
Note that depending on the values in mydata you may need to tweak the format string of num2str to get an accurate representation of the numbers as text.
4 Comments
Dhines
on 15 Dec 2022
@Guillaume can you tell set param command for below query
https://in.mathworks.com/matlabcentral/answers/1874647-how-to-access-bus-ports-parameter-from-action-bar-in-buscreator-busselector-blocks
Georgia - Eirini Lazaridou
on 23 May 2023
Mr/Mrs Guillaume i used your example and worked as well. My problem was: at the block Synchronous Machine pu Standard, i wanted to use the command "set_param" in order to change the parameters which are tables.
Thank you for your help!
More Answers (0)
See Also
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!