Separating and reprinting a big string
Mostrar comentarios más antiguos
I have a text file with about 45000 entries all on one line seperated by "//"
I would like to read this huge line from juneweather.txt, seperate it into seperate strings and write them onto a new file, each one on a new line. i keep getting the error
Error using fwrite
Cannot write value: nonscalar strings are unsupported.
Error in weather02 (line 16)
fwrite(fid1, john);
fid1=fopen('JuneWeather2.txt','at');
fid2=fopen('JuneWeather.txt'); %.... open the file, MATLAB assigns an ID
line=fgets(fid2);
greg=strsplit(line,'//');
%disp(greg);
for i=1:length(greg)
corey = {greg(i),'\r'};
john = string(corey);
fwrite(fid1, john);
end
Any ideas? thanks so much!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Characters and Strings en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!