Aligning columns in a matrix by padding with zeros
Show older comments
I have a matrix A below. The values in each column are all roughly 100 apart, but some of them are missing some values. They represent loci of peaks in a graph. I want to make a matrix B that puts the zeros where they need to be: where a value in a column is "skipped"
1698 1696 1699
1826 1819 1816
1928 1921 1921
2063 2065 2059
2184 2186 2181
2399 2278 2270
2544 2373 2373
2655 2449 2555
2792 2552 2652
0 2657 2796
0 2794 0
e.g. column 1 should be
1698
1826
1928
2063
2184
0
2399
0
2544
2655
2792
2 Comments
KSSV
on 20 Aug 2020
How you will determine that a column is skipped?
AbioEngineer
on 20 Aug 2020
Accepted Answer
More Answers (0)
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!