how i can store array of string for every loop

suppose i have a file 'M1.csv','M2.csv','M3.csv','M4.csv', how can i store it in the array and call them on the basis of requirement.

2 comentarios

Sun Heat
Sun Heat el 4 de Jun. de 2019
suppose i make a vector A=[ 'M1.csv','M2.csv','M3.csv','M4.csv']
if i want to read the data from position 3 i.e M3.csv , how i fetch it from the vector
Stephen23
Stephen23 el 4 de Jun. de 2019
Editada: Stephen23 el 4 de Jun. de 2019
Use a cell array:
A = {'M1.csv','M2.csv','M3.csv','M4.csv'};
A{1}
A{2}
etc.
Note that [] are a concatenation operator, so this
[ 'M1.csv','M2.csv','M3.csv','M4.csv']
is simply equivalent to this:
'M1.csvM2.csvM3.csvM4.csv'

Iniciar sesión para comentar.

 Respuesta aceptada

madhan ravi
madhan ravi el 4 de Jun. de 2019

0 votos

4 comentarios

Sun Heat
Sun Heat el 4 de Jun. de 2019
not helpfull....thanx for reply
madhan ravi
madhan ravi el 4 de Jun. de 2019
Editada: madhan ravi el 4 de Jun. de 2019
Not helpful.... so is the question to the readers. If it doesn’t do what you want why is it hard for you to explain where it doesn't meet the requirements. Well good luck then, what’s so difficult in reading the link?? Where is the illustration of the code that you tried?? If you had taken the time to read the link and the purpose of a for loop this statement would have been avoided.
Sun Heat
Sun Heat el 4 de Jun. de 2019
thank you
A=compose('M%d.csv',1:4);
A{3}

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Preguntada:

el 4 de Jun. de 2019

Editada:

el 4 de Jun. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by