# how to fill a matrix using the rows of another matrix

12 views (last 30 days)

Show older comments

### Answers (1)

Salman Ahmed
on 14 Oct 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.

##### 0 Comments

### See Also

### Community Treasure Hunt

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

Start Hunting!