Code was working fine, Same code is giving error 'Undefined function or variable 'pixelList'.

조회 수: 6 (최근 30일)
On the attached code I am trying to identify the number of pixel values below and above the threshold which is median value of the pixelvalues in this case. The code was working fine. But now it is giving me error "Undefined function or variable 'pixelList'." Can anyone help me why I am having this error. Also I put the values in struct and tried to write it in excel file. But it is only writing one images information in the file , I have 67 image files in the folder.

채택된 답변

Walter Roberson
Walter Roberson 2018년 11월 9일
Change
s(k).numberOfPixels = numel(pixelList);
To
s(k).numberOfPixels = numel(s(k).pixelList);
  댓글 수: 2
TRK
TRK 2018년 11월 9일
Thanks Walter. I changed that, it was still giving me same error. I did this change then,
s(k).pixelList = s(k).PixelValues;
s(k).numberOfPixels = numel(s(k).pixelList);
s(k).count2= s(k).numberOfPixels-s(k).count1;
it is working fine now. But I still cant have all the results in excel file, it is only writing one result in the excel file. Why it is like that?
Walter Roberson
Walter Roberson 2018년 11월 9일
Your writetable is inside the loop and you are not providing a range, so you would overwrite the file each time.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by