how to fill a matrix using the rows of another matrix

3 Ansichten (letzte 30 Tage)
MA
MA am 12 Sep. 2021
Beantwortet: Salman Ahmed am 14 Okt. 2021
I have a matrix A of size 8540X18, there is a specific column in that matrix that its whenever the next row is less than the previous row, we need to extract all the rows before that row and store them in another matrix B and then store that matrix in a seperate data file. anybody can help with this?
  7 Kommentare
Walter Roberson
Walter Roberson am 13 Sep. 2021
idxBkpt = find( diff[0;A.GDALT]) < 0 );
MA
MA am 13 Sep. 2021
Thank you for the help, I tried it now and it works perfectly fine. but now since I am dealig with a huge data set and the blocks we are trying to extract are having diffrenet sizes, how can I implement that using mat2cell?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Salman Ahmed
Salman Ahmed am 14 Okt. 2021
Hi manar,
From the comments, I understand that you wish to segregate your data into different cells whenever you hit peaks in your data. You could try the following operations on your data:
idx = find(diff([0;A.GDALT])<0); % Finding the breakpoints
B = mat2cell(A,[idx(1)-1;diff(idx);numel(A.GDALT)-idx(end)+1]); % Segregating the tables
Hope it solves your issue.

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by