Effacer les filtres
Effacer les filtres

Converting an array of string to an array of variables

1 vue (au cours des 30 derniers jours)
Gustavo
Gustavo le 20 Juin 2013
Hello Everyone,
I have the following code which creates an row vector of strings:
variables(1) = cellstr('p0');
for i = 1:52
str1 = sprintf('m%.0f',i);
str2 = sprintf('p%.0f',i);
variables(2*i) = cellstr(str1);
variables(2*i+1) = cellstr(str2);
end
What would be the best way to convert this "variables" array of strings into a an array of variables?
Thanks,
Gus

Réponses (1)

Vishal Rane
Vishal Rane le 21 Juin 2013
Not sure I understand your question. Are you trying to create an array of the 'variables' array ?
b(1:5)= {variables} % gives a 1*5 cell array where each element is 'variables'

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by