I have a string with the form of that of what you would write to initialize a matrix; how do I make the string a matrix?

1 visualización (últimos 30 días)
Title says it all. ex: myStr = [1,2,3, 5:7]; how do I make it so myArray = [1,2,3,5,6,7].
Thanks in advance, George

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 29 de Jun. de 2015
myStr = '[1,2,3, 5:7]'
out=evalin('base',myStr)

Más respuestas (1)

Thorsten
Thorsten el 29 de Jun. de 2015
myStr = '[1,2,3, 5:7]';
eval(['A = ' myStr ';']);

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by