How to separate specific data from an array in a new file?

1 次查看(过去 30 天)
Hello,
I have a doubt on how to separate different data from an array. For example: Each matrix has different number of rows and columns. In the first column of each matrix, the numbers 1, 2, and 3 always appear. How can I do to separate the data in a new file ??? containing only the data of the lines that have the number 1, that have the number 2 and that have the number 3 ???
Thanks and grateful for your help!

采纳的回答

dpb
dpb 2020-8-7
ia=ismember(data(:,1),[1:3]);
writematrix(data(ix,:))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by