set_param 'Table' datatype
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ubaldo
le 1 Août 2016
Commenté : Georgia - Eirini Lazaridou
le 23 Mai 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 commentaires
Réponse acceptée
Guillaume
le 1 Août 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 commentaires
Dhines
le 15 Déc 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
le 23 Mai 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!
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Programmatic Model Editing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!