Clear Filters
Clear Filters

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

12 views (last 30 days)
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,

Accepted Answer

Rik
Rik on 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.

More Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!