Borrar filtros
Borrar filtros

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

12 visualizaciones (últimos 30 días)
Mady J
Mady J el 13 de Sept. de 2018
Respondida: Rik el 13 de Sept. de 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,

Respuesta aceptada

Rik
Rik el 13 de Sept. de 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.

Más respuestas (0)

Categorías

Más información sobre MATLAB Coder en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by