transforming a matrix to an array without one values???

1 次查看(过去 30 天)
Hi all
I have a matrix having some values equal to one. I want to transform this matrix to an array without the one values.
how can I do this? for example a=[13 1 4; 45 23 1; 1 56 78] changed to b=[13 45 23 56 4 78]
cheers,

采纳的回答

Wayne King
Wayne King 2011-12-31
a=[13 1 4; 45 23 1; 1 56 78];
indices = find(a==1);
a(indices) = [];

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by