Set mask parameter with a cell array using set_param
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Siegfried Rotthäuser
el 18 de Mzo. de 2025
Comentada: Siegfried Rotthäuser
el 19 de Mzo. de 2025
I would like to set a custom Simulink block's mask parameter with a cell array:
C = {'a', 'b'};
set_param(gcb, 'mask_parameter', C);
This fails because the third parameter to set_param() must be a string.
However, this works:
C1 = '{''a'', ''b''}';
set_param(gcb, 'mask_parameter', C1);
as well as
mx = [1,2,3];
set_param(gcb, 'mask_parameter', mat2str(mx));
How can I convert C to a string? I need something like cell2str(C).
Can anyone help please?
0 comentarios
Respuestas (1)
Voss
el 18 de Mzo. de 2025
Here's a way to generate that C1 from that C
C = {'a', 'b'};
C1 = strrep(strtrim(char(formattedDisplayText(C))),'} {',', ')
C1_given = '{''a'', ''b''}';
isequal(C1,C1_given)
Ver también
Categorías
Más información sobre Subsystems en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!