Diff for "MatlabNotes" - CBU statistics Wiki
location: Diff for "MatlabNotes"
Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2008-04-25 13:58:40
Size: 66
Comment:
Revision 6 as of 2009-03-20 12:00:53
Size: 863
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:

=== reshape ===

=== shiftdim ===

`shiftdim` allows one to do generalised tranposition. If ''A'' is a matrix then `shiftdim(A,1)` is equal to `A'`. In fact the `1` can be any odd number; since transposition is of order 2 an even number will leave `A` unchanged.

{{{
>> A=reshape(1:12,3,4)

A =

     1 4 7 10
     2 5 8 11
     3 6 9 12

>> shiftdim(A,3)

ans =

     1 2 3
     4 5 6
     7 8 9
    10 11 12

>> shiftdim(A,6)

ans =

     1 4 7 10
     2 5 8 11
     3 6 9 12
}}}

=== circshift ===

== Useful links ==

http://www-h.eng.cam.ac.uk/help/tpl/programs/Matlab/faster_scripts.html

http://www-h.eng.cam.ac.uk/help/tpl/programs/Matlab/tricks.htm

Some Jottings Related to MATLAB

Manipulating Arrays

reshape

shiftdim

shiftdim allows one to do generalised tranposition. If A is a matrix then shiftdim(A,1) is equal to A'. In fact the 1 can be any odd number; since transposition is of order 2 an even number will leave A unchanged.

>> A=reshape(1:12,3,4)

A =

     1     4     7    10
     2     5     8    11
     3     6     9    12

>> shiftdim(A,3)

ans =

     1     2     3
     4     5     6
     7     8     9
    10    11    12

>> shiftdim(A,6)

ans =

     1     4     7    10
     2     5     8    11
     3     6     9    12

circshift

http://www-h.eng.cam.ac.uk/help/tpl/programs/Matlab/faster_scripts.html

http://www-h.eng.cam.ac.uk/help/tpl/programs/Matlab/tricks.htm

None: MatlabNotes (last edited 2013-03-08 10:18:03 by localhost)