필터 지우기
필터 지우기

Write value to excel

조회 수: 3 (최근 30일)
Hilbrand Swieringa
Hilbrand Swieringa 2015년 9월 22일
편집: Hilbrand Swieringa 2015년 9월 22일
Hello Everybody,
Due an internship assignment i'm using matlab. I haven't got many experience with it. My question is;
This is part of my code that i'm trying to get work. The meaning is to set a batch of images to grayscale and then crop at the given coördinates. After that i need to get the information of the average gray value and write that to excel. I can do it for one image, but i need to get a table with the information. the first value need to be written in 'B2' the next one in 'B3' the 3rd one in 'b4' etc.
Can someone help me with it?
Kind regards
Hilbrand

채택된 답변

Thorsten
Thorsten 2015년 9월 22일
You should compute the mean gray values of all images in the for loop as follows
B2(i) = mean2(I1);
B3(i) = mean2(I2);
B4(i) = mean2(I3);
Outside the for loop you then write the three B vectors to their specific sheets
xlswrite(filenamexlsx,B2,'B2');
xlswrite(filenamexlsx,B3,'B3');
xlswrite(filenamexlsx,B4,'B4');
  댓글 수: 3
Thorsten
Thorsten 2015년 9월 22일
편집: Thorsten 2015년 9월 22일
This makes more sense. So in the for loop, use
data(i,:) = [mean2(I1) mean2(I2) mean2(I3)];
And outside the loop write the data to the xls file
xlswrite(filenamexlsx,data);
Hilbrand Swieringa
Hilbrand Swieringa 2015년 9월 22일
I think I found the sollution! It seems to work right now for this part!!
Thank you for your help! :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2015년 9월 22일
Save all of the values in a cell array. At the end of the loop write out the cell array

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by