how to store all my result in the same table
1 次查看(过去 30 天)
显示 更早的评论
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];
0 个评论
回答(1 个)
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 个评论
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 Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!