How to extract a string name from a cell array and use it as name for a new variable?

12 vues (au cours des 30 derniers jours)
Ines le 10 Juin 2012
I want to make matlab use a string which was previously saved in a cell array for the construction of a new variable can I do this?
A={'wind force', 'temperature', 'humidity'}
%define a new variable temperature
temperature=input('temperature', 's')

Réponses (1)

Wayne King
Wayne King le 10 Juin 2012
Are you sure you want them to input the temperature as a string?
A={'wind force', 'temperature', 'humidity'};
temperature = input(A{2});


En savoir plus sur Characters and Strings 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!

Translated by