Writing 3D data into text files
Mostrar comentarios más antiguos
I want to write my 3D data in separate text files, my data matrix has dimensions = 8x256x32. I want to write 8 separate files, all having 256x32 data values. how can I do this? Kindly help me with the following code:
[a,b,c]=size(sig);
for x = 1:8
filename = ['signal' num2str(x) '.txt'];
for y = 1:256
for z = 1:32
dlmwrite(filename,sig(x,:,:),'delimiter','\t')
end
end
fclose(filename);
end
thank you.
5 comentarios
KSSV
el 18 de Oct. de 2017
When you write this matrix 256X32, data will be disturbed from 8X256 matrix.....is it okay?
Nabigha Nazneen
el 18 de Oct. de 2017
KSSV
el 18 de Oct. de 2017
I suggest you to write whole data 8x256x32 into single file......there are formats which support this.
Nabigha Nazneen
el 18 de Oct. de 2017
Respuestas (1)
You are talking about 65536 numbers. Text files are useful, if they are read or edited by a human, but nobody will read and understand such a pile of values.
Therefore it would be easier, faster and cleaner to store the values in a binary format using fwrite. This will allow for an easier method to import the data later on also.
1 comentario
Nabigha Nazneen
el 18 de Oct. de 2017
Categorías
Más información sobre Variables 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!