Filter löschen
Filter löschen

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

12 Ansichten (letzte 30 Tage)
Mady J
Mady J am 13 Sep. 2018
Beantwortet: Rik am 13 Sep. 2018
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,

Akzeptierte Antwort

Rik
Rik am 13 Sep. 2018
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.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by