필터 지우기
필터 지우기

How to read text file line by line and store line into cell array?

조회 수: 12 (최근 30일)
Mady J
Mady J 2018년 9월 13일
답변: Rik 2018년 9월 13일
Hello.
I have one text file that is : Testing2.txt.
****While the code has successfully generated, no makefile or other build support files will be generated. For
more information on the error that occurred, please refer to 'make_exception.mat' in the build folder.]
### Successful completion of code generation for model: ActiveRequest
model is not generated****
this is console log of generating code from simulink model. I need to read this file line by line and want to save data in cell array. i am trying with this code: but not working as expected.
line_ex = fgetl(file_id);
disp(line_ex)
C = textscan(file_id,nchar);
fclose(file_id);
Can anybody tell me solution please. Thanks,

채택된 답변

Rik
Rik 2018년 9월 13일
You need to generate a valid fileID with fopen. Then you can use other file reading tools, which you shouldn't mix like this.
You can use my FEX submission readfile to read a file to a cell array, or take the relevant code from it.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by