|
On Nov 23, 1:38 pm, "Cesar B" <coyoteinven...@hotmail.com> wrote:
> Hi there! I need some help from more experienced users since I am kind of lost on what is going on in my code.
>
> (1) I define an array line this:
> BT(1,1)=0.125;
> BT(1,2)=0.125;
> BT(1,3)=0.125;
> BT(1,4)=0.125;
> BT(1,5)=0.125;
> BT(1,6)=0.125;
> BT(1,7)=0.125;
> BT(2,1)=0.125;
> BT(2,2)=0.125;
> BT(2,3)=0.125;
> BT(2,4)=0.125;
> BT(2,5)=0.125;
> BT(2,6)=0.125;
> BT(2,7)=0.125;
> BT(3,1)=0.125;
> BT(3,2)=0.125;
> BT(3,3)=0.125;
> BT(3,4)=0.125;
> BT(3,5)=0.125;
> BT(3,6)=0.125;
> BT(3,7)=0.125;
> BT(4,1)=0.125;
> BT(4,2)=0.125;
> BT(4,3)=0.125;
> BT(4,4)=0.125;
> BT(4,5)=0.125;
> BT(4,6)=0.125;
> BT(4,7)=0.125;
> BT(5,1)=0.125;
> BT(5,2)=0.125;
> BT(5,3)=0.125;
> BT(5,4)=0.125;
> BT(5,5)=0.125;
> BT(5,6)=0.125;
> BT(5,7)=0.125;
> BT(6,1)=0.125;
> BT(6,2)=0.125;
> BT(6,3)=0.125;
> BT(6,4)=0.125;
> BT(6,5)=0.125;
> BT(6,6)=0.125;
> BT(6,7)=0.125;
> BT(7,1)=0.125;
> BT(7,2)=0.125;
> BT(7,3)=0.125;
> BT(7,4)=0.125;
> BT(7,5)=0.125;
> BT(7,6)=0.125;
> BT(7,7)=0.125;
>
> (2) I then call a function passing BT as part of it:
> [X,P,cb,U]=imm_part1(ekf_status, sensors, s1_ekfs, s2_ekfs, s3_ekfs, X, BT, P, U1, U, cb);
>
> (3) and in the function I receive it like this:
> function [X0,P0,cb0,U0]=imm_part1(ekf_status, sensors, s1_ekfs, s2_ekfs, s3_ekfs, X, P, BT, U1, U, cb)
>
> (4) It errors like such when trying to multiply the arrays:
> 293 [X,P,cb,U]=imm_part1(ekf_status, sensors, s1_ekfs, s2_ekfs, s3_ekfs, X, BT, P, U1, U, cb);
> ??? Undefined function or method 'mtimes' for input arguments of type 'cell'.
> Error in ==> imm_part1 at 18
> cb0(c,1)=cb0(c,1)+BT(r,c)*U1(r,1);
> Error in ==> sf_main at 293
> [X,P,cb,U]=imm_part1(ekf_status, sensors, s1_ekfs, s2_ekfs, s3_ekfs, X, BT, P, U1, U, cb);
>
> Now, the problem is this. Investigating my problem I noticed (in debug mode) that up to the point I call the function the BT array is still a 7x7 "double" array like defined, but as soon as I step into the imm_part1 function then the BT array changes to a 1x7 cell, with each element now being a 2x2 "double" array (very different from how I defined it).
>
> I could have swear I had this working before, but I guess it must be something on how I am passing the BT array? Any help will be greatly appreciated! :-)
>
> Cesar
Quick note:
A quicker way to define your BT:
BT = ones(7).*.125
-Nathan
|