how i can store array of string for every loop

2 views (last 30 days)
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 Comments
Sun Heat
Sun Heat on 4 Jun 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 on 4 Jun 2019
Edited: Stephen23 on 4 Jun 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'

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 4 Jun 2019
  4 Comments

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!