writing a cat file
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i have a values
A=[m V SD],where m is mean, v is variance ,sd is standard dev of an image
now i want to write A into folder ,my folder name is new1
i have 100 images ,and have found m,v,sd for all images
so in that folder i need to store all values i.e(A1 to A100) please help
4 commentaires
Jan
le 15 Déc 2011
This is your 107th question in this forum. It is time to learn how to include all necessary details to a question. Currently you could get an acceptence rate of only 19%. Improving the quality of your questions would be a very good idea.
E.g. at first you are talking of the vector A and explain, what the values mean. But for the actual problem rand(1,4) would be equivalent also. In opposite to such unnecessary information, it is not explained anywhere whar "A1" and "A100" is. Later on in this thread it comes out, that you can to save a struct instead.
Finally, when I see the bunch of problems you have posted here, it is very hard for me to imagine, that you cannot find out, how to write some numbers to a file. Pat, this is extremly basic.
Réponse acceptée
Chandra Kurniawan
le 15 Déc 2011
Hello, Pat
I just give you small example.
Then, I hope you can use it or do modification on it for your purpose.
clear; clc;
for cnt = 1 : 10
m = 255*rand;
V = 255*rand;
SD = 255*rand;
filename = strcat(pwd,'\New1\A',num2str(cnt),'.txt');
fid = fopen(filename, 'w');
fprintf(fid,'mean : %.2f\n variance : %.2f\n standard dev : %.2f\n',m,V,SD);
fclose(fid);
end
6 commentaires
Jan
le 15 Déc 2011
@Chandra: FULLFILE is more secure than "strcat(pwd,'\New1\A',num2str(cnt),'.txt')". e.g. if the current folder is "C:\" the trailing file separator is considered.
@Pat: You've asked a question and Chandra gave a working asnwer. Afterwards you modify the conditions. It is obvious that this wastes the time of Chandra and all others who want to assist here.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Function Creation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!