From: Alex on 21 Jun 2010 05:44 Dear all, I don't manage to get a 4D array from a serie of 3D arrays that underwent the same function? I mean: a=arrayfun(@(i) fun(V.i), 1:n) the output is an error, unless i add UniformOutput false at the end. but the result is a cell array in this case. while i want a normal array instead. since i have to repeat this operation many times i don't want to use cat into a loop. thanks alex
From: Bruno Luong on 21 Jun 2010 05:59 "Alex " <demarco_alex(a)yahoo.it> wrote in message <hvnc96$btj$1(a)fred.mathworks.com>... > Dear all, > I don't manage to get a 4D array from a serie of 3D arrays that underwent the same function? I mean: > a=arrayfun(@(i) fun(V.i), 1:n) > the output is an error, unless i add UniformOutput false at the end. but the result is a cell array in this case. while i want a normal array instead. > since i have to repeat this operation many times i don't want to use cat into a loop. Just use FOR-LOOP. ARRAYFUN is not fast or convenient, so back to the basic. Bruno
From: Wayne King on 21 Jun 2010 06:04 "Alex " <demarco_alex(a)yahoo.it> wrote in message <hvnc96$btj$1(a)fred.mathworks.com>... > Dear all, > I don't manage to get a 4D array from a serie of 3D arrays that underwent the same function? I mean: > a=arrayfun(@(i) fun(V.i), 1:n) > the output is an error, unless i add UniformOutput false at the end. but the result is a cell array in this case. while i want a normal array instead. > since i have to repeat this operation many times i don't want to use cat into a loop. > thanks > alex Hi Alex, you should give us a specific example with code. We don't know what fun() is (what function it is, is it a Matlab function?) and what 1:n is supposed to be, etc. You can make a couple small 3D arrays to illustrate your point. Wayne
From: Alex on 21 Jun 2010 06:33 "Wayne King" <wmkingty(a)gmail.com> wrote in message <hvndek$oi8$1(a)fred.mathworks.com>... > "Alex " <demarco_alex(a)yahoo.it> wrote in message <hvnc96$btj$1(a)fred.mathworks.com>... > > Dear all, > > I don't manage to get a 4D array from a serie of 3D arrays that underwent the same function? I mean: > > a=arrayfun(@(i) fun(V.i), 1:n) > > the output is an error, unless i add UniformOutput false at the end. but the result is a cell array in this case. while i want a normal array instead. > > since i have to repeat this operation many times i don't want to use cat into a loop. > > thanks > > alex > > Hi Alex, you should give us a specific example with code. > > We don't know what fun() is (what function it is, is it a Matlab function?) and what 1:n is supposed to be, etc. You can make a couple small 3D arrays to illustrate your point. > > Wayne the function is a rotation function coming from a mex file. basically I rotate a set of 3Darrays and at last I average them. n is generally 5000. alex
From: Bruno Luong on 21 Jun 2010 06:58 "Alex " <demarco_alex(a)yahoo.it> wrote in message <hvnf51$b3o$1(a)fred.mathworks.com>... > "Wayne King" <wmkingty(a)gmail.com> wrote in message <hvndek$oi8$1(a)fred.mathworks.com>... > > the function is a rotation function coming from a mex file. > basically I rotate a set of 3Darrays and at last I average them. > n is generally 5000. > alex > Typically when working with Matlab, you need to vectorize your code, i.e., make it works on arrays rather than elements. Let me reiterate; ARRAYFUN won't do miracle. Bruno
|
Pages: 1 Prev: how to display images using axes which is inside uipanel Next: Reading .mfc file |