writing a cat file

5 Ansichten (letzte 30 Tage)
Pat
Pat am 15 Dez. 2011
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 Kommentare
Pat
Pat am 15 Dez. 2011
text file
Jan
Jan am 15 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Chandra Kurniawan
Chandra Kurniawan am 15 Dez. 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 Kommentare
Jan
Jan am 15 Dez. 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.
Pat
Pat am 15 Dez. 2011
no jan,i had two different questions,i got the answers,thank u chandra

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Function Creation finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by