how to use "save" matlab
Afficher commentaires plus anciens
Hi all, i create a very big file in matlab and then i try to write it in a txt file using the fprintf() function. But after a while a message pops up saying that there is not enough memory or sth like that.. How can i save it in the txt file? Can i use the save function of matlab to do that?
thanks. Daniel
12 commentaires
How big is "very big"???
We need exact, complete error messages in context, not cute snippets of "or sth like that". Even with all the talents of forum denizens, the Mind Reading Toolbox isn't widely available.
Show the code snippet that tried to write the file and the resulting error cut 'n pasted from the command window without edits.
Why would you choose to save a large file as text, anyway? Surely you wouldn't expect/need a user to look at it manually that way?
Use save and save it as a .mat file instead.
Daniel Barzegar
le 19 Juin 2014
José-Luis
le 19 Juin 2014
That's really not very big. What commands are you using?
Daniel Barzegar
le 19 Juin 2014
Daniel Barzegar
le 19 Juin 2014
Daniel Barzegar
le 19 Juin 2014
José-Luis
le 19 Juin 2014
a = 1:3;
your_data = a(4)
You are probably trying to do something like that. You are trying to access something that does not exist.
Please try using the debugger and look at the offending variables. The error should become evident.
Image Analyst
le 19 Juin 2014
Daniel, it's like pulling teeth. Where is your code or the FULL error message, or both? Why won't you let us help you by providing it?????????????????
Daniel Barzegar
le 19 Juin 2014
Daniel Barzegar
le 19 Juin 2014
dpb
le 19 Juin 2014
The other files don't exist or are somewhere else, maybe? Hard to say from here, you'll have to poke around at the command line and see what's what...
Réponse acceptée
Plus de réponses (1)
your_data = rand(60000,16);
fid = fopen('data.txt','w');
fprintf(fid, [repmat('%f ',1,size(your_data,2)) '\n'], your_data)
fclose(fid)
About 8MB. Please provide feedback on the answers you get.
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!