writing a cat file

조회 수: 6 (최근 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에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by