Mercurial > repos > public > sbplib
comparison reshapeToPlotMatrix.m @ 163:51aaf67a7df5 feature/grids
Fixed naming and added functions for converting vectors to matrices for structured grid.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 22 Feb 2016 13:55:19 +0100 |
parents | c75c03f692b3 |
children |
comparison
equal
deleted
inserted
replaced
162:c75c03f692b3 | 163:51aaf67a7df5 |
---|---|
1 % Takes a grid function and reshapes it into a matrix of shape m for plotting. | 1 % Takes a grid function and reshapes it into a matrix of shape m for plotting. |
2 % Called by class methods. | 2 function F = reshapeToPlotMatrix(gf, m) |
3 function F = funcToPlotMatrix(gf, m) | |
4 D = length(m); | 3 D = length(m); |
5 | |
6 | |
7 | 4 |
8 switch D | 5 switch D |
9 case 1 | 6 case 1 |
10 F = gf; | 7 F = gf; |
11 case 2 | 8 case 2 |
13 case 3 | 10 case 3 |
14 % After the reshape the indecies will be M(z,y,x). Plot need them to be M(y,x,z) | 11 % After the reshape the indecies will be M(z,y,x). Plot need them to be M(y,x,z) |
15 p = [2 3 1]; % Permuation | 12 p = [2 3 1]; % Permuation |
16 F = permute(reshape(gf,rot90(m,2)), p); | 13 F = permute(reshape(gf,rot90(m,2)), p); |
17 otherwise | 14 otherwise |
18 error('grid:funcToMatrix:NotImplemented','Grid function to matrix is not implemented for dimension = %d', length(m)); | 15 error('reshapeToPlotMatrix:NotImplemented','Grid function to matrix is not implemented for dimension = %d', length(m)); |
19 end | 16 end |
20 end | 17 end |