Something like reshape but accounting for missing values
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a columnwise array of x- and y-coordinates with values at those x,y pairs. The full set of coordinates is predetermined and known, but in this array there isn't a value at every x,y pair. When there's no value, it's just skipped, so the original array cannot be rearranged using reshape. For example, the original array may look like this
x1 y3 v13
x2 y2 v22
x2 y3 v23
x3 y1 v31
x3 y2 v32
x3 y3 v33
and I want this
NaN NaN v31
NaN v22 v32
v13 v23 v33
I want to rearrange this original array to put the values in an array whose size is determined by the full set of coordinates with NaNs where there are missing values, and I want it to be fast. It'd be kind of like reshape, except, because there are missing (not empty) values, I don't want to cut up the column in a regular way to reshape. I think if there was a 2D interpolation option that allowed one to replace the "missing" elements with a constant, that would work, but I can't find that. I would replace them with NaNs in that case.
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!