MATLAB coder alternatives for textread.
Ältere Kommentare anzeigen
Hi,
I am trying to convert my matlab project to C++ using the coder but I am facing problems with reading some text files. After reading around I learned that Coder does not support textscan() or fgetl() or fgets() or fgetc() or fscanf() or sscanf() .
I am not that experienced with matlab so now I am stuck at this point.
I have files that contain complex numbers in the following format
-0.00006 +0.00027
-0.00018 -0.00009
-0.00015 -0.00003
-0.00009 +0.00006
-0.00018 -0.00003
-0.00012 +0.00003
+0.00006 +0.00009
+0.00000 +0.00018
-0.00006 -0.00003
+0.00006 +0.00006
+0.00009 +0.00000
+0.00000 +0.00000
+0.00003 -0.00003
+0.00003 +0.00012
+0.00012 -0.00003
+0.00003 -0.00003
-0.00012 -0.00006
-0.00015 -0.00006
Which I am trying to read into an array. And then some files in the following format.
1
2,1
3,2,1
4,3,1,2
2,1,5,4,3
5,1,6,4,2,3
4,6,7,5,2,1,3
6,1,4,5,2,8,7,3
7,6,2,9,8,4,1,3,5
9,10,4,6,8,2,5,3,1,7
11,6,4,3,1,8,5,7,2,10,9
.
.
.
.
What are some ways in which I can read these files into an array which is also accesptable by MATLAB coder. Any help is appreciated.
Thank you
Akzeptierte Antwort
Weitere Antworten (1)
dpb
am 12 Jul. 2021
1 Stimme
indicates beginning with R2019b Coder does support the above functionality albeit behavior may be different than that inside MATLAB, reverting to the base C language behavior.
Kategorien
Mehr zu MATLAB Coder finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!