writing a cat file

1 次查看(过去 30 天)
Pat
Pat 2011-12-15
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 个评论
Pat
Pat 2011-12-15
text file
Jan
Jan 2011-12-15
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.

请先登录,再进行评论。

采纳的回答

Chandra Kurniawan
Chandra Kurniawan 2011-12-15
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 个评论
Jan
Jan 2011-12-15
@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 2011-12-15
no jan,i had two different questions,i got the answers,thank u chandra

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by