Azzera filtri
Azzera filtri

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

12 visualizzazioni (ultimi 30 giorni)
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,

Risposta accettata

Rik
Rik il 13 Set 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.

Più risposte (0)

Categorie

Scopri di più su MATLAB Coder in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by