setReshapeVecMat

Defines functions to reshape a vector into a matrix and vice versa.

Contents

Syntax

seti = setReshapeVecMat(seti)

Description

seti = setReshapeVecMat(seti) defines functions seti.GROI and seti.GCD to reshape vectors into matrices of size seti.nROI

Example

init;
seti.dim = 2;
seti.nCD = 8;
seti.nROI = 3;
seti = setReshapeVecMat(seti);
v = rand(seti.nROI^seti.dim,1) % vector
M = seti.GROI(v) % write vector as matrix
v = seti.iG(M) % write matrix as vector again

Input Arguments

Output Arguments

See Also

Code

function seti = setReshapeVecMat(seti)

reshapeVecROI = seti.nROI*ones(1,seti.dim);
seti.GROI = @(x) reshape(x,reshapeVecROI); %  G: n x 1  -> matrix

reshapeVecCD = seti.nCD*ones(1,seti.dim);
seti.GCD  = @(x) reshape(x,reshapeVecCD); %  G: n x 1  -> matrix

seti.G = @(q) seti.GROI(q);

seti.iG = @(x) x(:);                  % iG: matrix -> n x 1

end