To store elements with different datatypes from loop

조회 수: 1 (최근 30일)
Khaing Zin Htwe
Khaing Zin Htwe 2016년 4월 18일
댓글: Khaing Zin Htwe 2016년 4월 20일
Hello my seniors, Could you please help me because I have faced some problems to store elements with different data types.I want to store double array ,structure array that I calculated from loop . How can I store these heterogeneous data types . Thanks all ......

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 18일
Use cell arrays
M{1}=[1 2 3];
M{2}=5
M{3}='text'
  댓글 수: 2
Khaing Zin Htwe
Khaing Zin Htwe 2016년 4월 20일
Thanks a lot for your kind answer,sir.I wrote that code below,but I got only results for the first iteration,not the second.Why please?Here, Nnodule is 2.
if true
% if Nnodule>=1
for i=1:Nnodule
if Nnodule==1
DetectNodule=Nodule;
else if Nnodule>1
if i==1
DetectNodule=NoduleOne;
else if i==2
DetectNodule=NoduleTwo;
else disp('No');
end
end
else disp('No');
end
end
figure,imshow(DetectNodule);
stats=regionprops(DetectNodule,'Area','ConvexArea','Eccentricity','EquivDiameter','Perimeter','Solidity');
allArea=stats.Area;
ConvexA=stats.ConvexArea;
Eccen=stats.Eccentricity;
Diameter=stats.EquivDiameter;
Perimeter=stats.Perimeter;
soli=stats.Solidity;
Roundness=4*pi*allArea/Perimeter^2; Skew=skewness(DetectNodule); Kur=kurtosis(DetectNodule); Variance=var(DetectNodule); Standard=std(DetectNodule); Smoothness=1-1./(1+uint8(Standard)); end i=i+1; end end
Khaing Zin Htwe
Khaing Zin Htwe 2016년 4월 20일
Thanks , I did it right now,sir. I used the whole image that includes all objects,2 objects here,not used DetectNodule in regionprops .If that line is okay, the later lines are all okay.now i got results for both objects.Thanks sir.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by