Please format this code..?

function [] = myFunction(imageNumber)
I = imread(sprintf('%d.png',imageNumber));
threshold = graythresh(I);
originalImage = im2bw(I, threshold);
i = bwareaopen(originalImage,350);
m = max(max(i));
[r c] = find(i == m);
fid = fopen(sprintf('Image%d_lalit1.txt',imageNumber),'wt');
for j=1:length(r),
fprintf(fid,'%f %f\n',r(j),c(j));
end
fclose(fid);
data = textread(sprintf('Image%d_lalit1.txt',imageNumber));
r = unique(data);
for i=r',
c = data(data(:,2)==i,1);
z(i,1) = mean([min(c) max(c)]);
end
fid = fopen(sprintf('patil%d.txt',imageNumber),'wt');
for j=1:length(z),
fprintf(fid,'%f %f\n',j,z(j));
end
data = textread(sprintf('patil%d.txt',imageNumber));
data(data(:,2) > 279, :) = [];
.......................................................................................................................................................
and now i want to save this files, so, what will be the last line of this function..?
I my self, first asked the question, then i was unclear about this so, i deleted it, now i again stucked so, i asked this as new question..

댓글 수: 5

TAB
TAB 2012년 12월 6일
Nothing
*OR *
end
Lalit Patil
Lalit Patil 2012년 12월 6일
편집: Lalit Patil 2012년 12월 6일
I have edited last second line..
This last two lines will find all that data in second column which is greater than 279 and, now i want to save this data in new text files and its corresponding data from first column..
so, how to do it.?
José-Luis
José-Luis 2012년 12월 6일
Please format your post properly. It will make it easier for people to help you.
Jan
Jan 2012년 12월 6일
Who has changed the title of this question to "please format this code...?"?
Lalit Patil
Lalit Patil 2012년 12월 7일
In this code at last two lines it reads data from patil%d and processing
data(data(:,2) > 279, :) = [];
this it updates patil%d only with second column, but i want to create a new file which saves this second column operation and its corresponding first column element..
But, actually i changed the way now, i didn't want to add this two lines in this code, instead i taken it as another function..
So, it solved..

답변 (1개)

Muruganandham Subramanian
Muruganandham Subramanian 2012년 12월 6일
편집: Muruganandham Subramanian 2012년 12월 6일

0 개 추천

Use 'diary' command

이 질문은 마감되었습니다.

질문:

2012년 12월 6일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by