How to look up corresponding 2D matrix from a table of 8 columns?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have 8 columns corresponding to thickness 0,5,10,15,20,25,30,35cm. Each column/thickness consist of one 2D matrix.
Columns 1 through 5
[1024x1024 double] [1024x1024 double] [1024x1024 double] [1024x1024 double] [1024x1024 double]
Columns 6 through 8
[1024x1024 double] [1024x1024 double] [1024x1024 double]
How do I get a corresponding 2D matrix for a known thickness, e.g.7cm?
0 Kommentare
Antworten (1)
Titus Edelhofer
am 23 Jul. 2012
Hi,
in this case probably this is easiest done by hand:
columns = 0:5:35;
thick = 7;
% find the 2 indices where 7 falls in between:
idx = find(columns<=thick, 1, 'last');
fraction = (thick-columns(idx)) / (columns(idx+1)-columns(idx));
% the interpolation matrix is the left one + a fraction of the difference:
matrix = allMatrices{idx} + fraction * (allMatrices{idx+1}-allMatrices{idx});
Note, you need to handle the cases thick<0 and thick>=35 with care.
Titus
2 Kommentare
Titus Edelhofer
am 23 Jul. 2012
Hmm, with the original question/answer you get the 2D interpolation matrix for one thickness. If thick is a 2D matrix (say NxM), and you loop, you will get N*M interpolation matrices of size 1024x1024. If N and M are not too large, this is no problem.
Siehe auch
Kategorien
Mehr zu Matrices and Arrays 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!