MATLAB Answers

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

조회 수: 1(최근 30일)
Matheus Brito
Matheus Brito 7 Aug 2020
답변: dpb 7 Aug 2020
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!

  댓글 수: 0

댓글을 달려면 로그인하십시오.

채택된 답변

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

  댓글 수: 0

댓글을 달려면 로그인하십시오.

추가 답변(0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by