Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How can I update a file string to CSVREAD in a for loop?

조회 수: 1 (최근 30일)
onamaewa
onamaewa 2018년 11월 10일
마감: Walter Roberson 2018년 11월 10일
My files are in 1 folder which I set in Matlab as my Current Folder. The names are: g1, g2, g3, g4, g5, g6, and so on...
Currently, I'm importing using the code below.
h1 = csvread('g1.csv', 9, 0, [9, 0, 10008, 8]);
h2 = csvread('g2.csv', 9, 0, [9, 0, 10008, 8]);
h3 = csvread('g3.csv', 9, 0, [9, 0, 10008, 8]);
h4 = csvread('g4.csv', 9, 0, [9, 0, 10008, 8]);
h5 = csvread('g5.csv', 9, 0, [9, 0, 10008, 8]);
h6 = csvread('g6.csv', 9, 0, [9, 0, 10008, 8]);...
It works, but I know there has to be a way to loop this function. I'm trying to do something like this.
for (i = 1:10)
csvread('g(i).csv', 9, 0, [9, 0, 10008, 8])
end
Any ideas on a simple for-loop to complete this task?
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 11월 10일
https://www.mathworks.com/matlabcentral/answers/429032-how-can-i-loop-my-csv-reader duplicate

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by