how i can store array of string for every loop

조회 수: 3 (최근 30일)
Sun Heat
Sun Heat 2019년 6월 4일
편집: Stephen23 2019년 6월 4일
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
Sun Heat
Sun Heat 2019년 6월 4일
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 2019년 6월 4일
편집: Stephen23 2019년 6월 4일
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'

댓글을 달려면 로그인하십시오.

채택된 답변

madhan ravi
madhan ravi 2019년 6월 4일
  댓글 수: 4
Sun Heat
Sun Heat 2019년 6월 4일
thank you
madhan ravi
madhan ravi 2019년 6월 4일
A=compose('M%d.csv',1:4);
A{3}

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by