From: Adam Hartshorne on
I have an array, A, of user defined objects, lets call the Object Quaternion. The Object simply stores 4 doubles, w, x, y, z....

Now I have function, which takes a Quaternion and produces a new slightly altered one. For the simplicity of the example lets just say I am going to add 0.1 to w (in my actual case the function is more complex then simply a matter of updating a single varilable).

function quaternion = update_quat (quaternion)
quaternion.w = quaternion.w + 0.1 ;
end

Now I want to apply this function to every element of A. When I try and do,

new_A = arrayfun(@update_quat, A) ;

I get,

??? Error using ==> arrayfun
Unsupported ARRAYFUN input type: Quaternion

Any help much appreciated,

Adam
 | 
Pages: 1
Prev: Cylinder visualization
Next: Hex in Constant Block