0
所以這是我的代碼:如何刪除行,而不在MATLAB用break
in=-8:8;
%calculate z
[h,k,l]=meshgrid(in);
z = (h.^2 + k.^2 + l.^2);
%sort absolute values ascending, which allows to use unique
ac=sort(abs([h(:) k(:) l(:)]),2);
%use unique to identify duplicates
[f,g,p]=unique(ac,'rows');
%count
cnt=histc(p,1:max(p));
% create a matrix with all vectors
disp([h(g),k(g), l(g),z(g),cnt])
我只是想刪除或終止含ž> 59,我不能用破,因爲它只能在行循環或while循環,那麼我可以使用什麼其他命令?謝謝。
中使用的基體要刪除的行? – thewaywewalk 2015-02-05 18:56:38
一個已經排序的矩陣,並有一列 – matlabnewbie 2015-02-05 18:59:14
,所以你顯示的那個,如'輸出= [h(g),k(g),l(g),z(g),cnt]'? – thewaywewalk 2015-02-05 19:00:16