Mercurial > repos > public > sbplib
comparison reshapeToPlotMatrix.m @ 820:501750fbbfdb
Merge with feature/grids
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 07 Sep 2018 14:40:58 +0200 |
parents | 51aaf67a7df5 |
children |
comparison
equal
deleted
inserted
replaced
819:fdf0ef9150f4 | 820:501750fbbfdb |
---|---|
1 % Takes a grid function and reshapes it into a matrix of shape m for plotting. | |
2 function F = reshapeToPlotMatrix(gf, m) | |
3 D = length(m); | |
4 | |
5 switch D | |
6 case 1 | |
7 F = gf; | |
8 case 2 | |
9 F = reshape(gf, rot90(m,2)); | |
10 case 3 | |
11 % After the reshape the indecies will be M(z,y,x). Plot need them to be M(y,x,z) | |
12 p = [2 3 1]; % Permuation | |
13 F = permute(reshape(gf,rot90(m,2)), p); | |
14 otherwise | |
15 error('reshapeToPlotMatrix:NotImplemented','Grid function to matrix is not implemented for dimension = %d', length(m)); | |
16 end | |
17 end |