import text file in loop

조회 수: 1 (최근 30일)
Nicolas
Nicolas 2018년 4월 6일
답변: Nicolas 2018년 4월 6일
Hi, I'm creating text files from another program that I want to import into Matlab. I have been using the import wizard matlab option (see attachment), however the size of each file is different. In the function created by Matlab, I would like to know if the 'formatSpec' can be defined automatically or if I can create it for every new file?
  댓글 수: 2
Rik
Rik 2018년 4월 6일
If you can deduce for each file what the format spec should be, you can just use it as an input to this function
Nicolas
Nicolas 2018년 4월 6일
편집: Nicolas 2018년 4월 6일
what I know is the number of time '%s' is repeated in the 'formatSpec'. not sure if I can build 'formatSpec' myself? be able to write %s."number of values"%[^\n\r]

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

채택된 답변

Nicolas
Nicolas 2018년 4월 6일
Answer to automatically build 'formatSpec' using the import function created by Matlab.
A = repmat('%s',1,201);
B = '%[^\n\r]';
formatSpec = strcat(A,B);

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by