matrix operations within an array
Mostra commenti meno recenti
Hi, I am not an advanced matlab user and I would appreciate any help wit my code.
The basic idea is to create an array of of matrices and then manipulate or transform the
matrices in the array, for example, let us start with something simple like transpose
each matrix matrix of the array. I am using arrayfun and transpose to do that.
I would appreciate any code input or any reference for advanced tutorial on how to manipulate
or apply functions to elements of an array. Thanks.
Here is my code, but it does not work.
>> X=2*rand(2,3,10)-1; % array of length N of 2 by 2 random matrices
Y=arrayfun(@(x) x',X );
% checking
X(:,:,1) % first matrix of the array X
Y(:,:,1) % first matrix of the array Y, X was not tranposed
ans =
-0.2198 0.2390 0.5588
-0.5573 0.1354 -0.9212
ans =
-0.2198 0.2390 0.5588
-0.5573 0.1354 -0.9212
>>
Risposte (1)
Andrei Bobrov
il 20 Mar 2014
Modificato: Andrei Bobrov
il 20 Mar 2014
permute(X,[2 1 3]) % transposed each frame
variant with arrayfun (badly)
Y = arrayfun(@(ii)X(:,:,ii)',1:size(X,3),'un',0 );
Y = cat(3,Y{:});
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!