comparison reshapeToPlotMatrix.m @ 427:a613960a157b feature/quantumTriangles

merged with feature/beams
author Ylva Rydin <ylva.rydin@telia.com>
date Thu, 26 Jan 2017 15:59:25 +0100
parents 51aaf67a7df5
children
comparison
equal deleted inserted replaced
426:29944ea7674b 427:a613960a157b
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