Mercurial > repos > public > sbplib
comparison reshapeToPlotMatrix.m @ 886:8894e9c49e40 feature/timesteppers
Merge with default for latest changes
| author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
|---|---|
| date | Thu, 15 Nov 2018 16:36:21 -0800 |
| parents | 51aaf67a7df5 |
| children |
comparison
equal
deleted
inserted
replaced
| 816:b5e5b195da1e | 886:8894e9c49e40 |
|---|---|
| 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 |
