how to store all my result in the same table

조회 수: 1 (최근 30일)
bil bbil
bil bbil 2014년 8월 10일
댓글: Image Analyst 2014년 8월 10일
hello..i need help plzz I want to store all my result in the same table..
*....................... T = zeros(3);
for i=1:numel(stats)
mark_i=mark == i;
mark_i_ends =bwmorph(mark_i,'endpoints');
[row,col]=find(mark_i_ends);
plot(col,row,'r.','markersize',5);
dist=sqrt((row(1)-row(2))^2 + (col(1)-col(2))^2);
bwdist=bwdistgeodesic(mark_i,col(1),row(1),'quasi-euclidean');
path=max(bwdist(:));
tortuosity=path/dist;
T(i,:,:,:) = [col,row,tortuosity];
end
*............................................
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
(line 56)
T(i,:,:,:) = [col,row,tortuosity];

답변 (1개)

Image Analyst
Image Analyst 2014년 8월 10일
You define T as a 1D vector of 3 elements. Then you try to assign 3 elements to a 3D volume of a 4 dimensional array. You can't do that.
Preallocate T:
T = zeros(numel(stats), 3);
Then in the loop
T(i, :) = [col, row, tortuosity];
Do not call your variable bwdist! bwdist is a built-in function and I wouldn't be surprised if bwdistgeodesis used in internally, but you've blown it away by calling your variable that. Likewise, DO NOT CALL YOUR VARIABLE PATH! Again, it's a built-in function. You'll run into trouble if you destroy it like you're doing.
  댓글 수: 2
bil bbil
bil bbil 2014년 8월 10일
thanks for you help...but bwdist works fine for me....the problem I have left is the storage
T = zeros(numel(stats),3);
for i=1:numel(stats)
mark_i=mark == i;
mark_i_ends =bwmorph(mark_i,'endpoints');
[row,col]=find(mark_i_ends);
plot(col,row,'r.','markersize',5);
dist=sqrt((row(1)-row(2))^2 + (col(1)-col(2))^2);
bwdist=bwdistgeodesic(mark_i,col(1),row(1),'quasi-euclidean');
path=max(bwdist(:));
tortuosity=path/dist;
T(i,:) = [col,row,tortuosity];
end
%
Dimensions of matrices being concatenated are not consistent.
Error in tortio (line 42) T(i,:) = [col,row,tortuosity];
Image Analyst
Image Analyst 2014년 8월 10일
I'm truly stunned by your first statement where you ignored my advice not to name variables after built in functions. You didn't directly ask another question, but I'm not sure you would take my advice if I offered any. Good luck.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by