向量:
>> a=[1,0,2,3,0,4,5]
a =
1 0 2 3 0 4 5
>> a(find(a==0))=[]
a =
1 2 3 4 5
矩陣:
>> a=[0 0;1 2;0 0;3 4]
a =
0 0
1 2
0 0
3 4
>> a(find(a==0))=[]
a =
1 3 2 4
>> a=reshape(a,2,2)
a =
1 2
3 4
謝謝!
回覆刪除