08-18-2010 09:31 AM
That error is pretty explicit. You are feeding in an array of one element. Yet you are trying to index out element 6. Obviously, that will generate an error. You have to provide an array that's large enough...
Be aware that MathScript is NOT the same as Matlab. MathScript is NI's implementation of a language that's similar to Matlab, but it is NOT a 100% replacement, and will never be (regardless of what the sales people will say). There are differences in the syntax and the functions, so if you decide to stick with MathScript you will likely need to do further debugging to see what else it complains about and to check the LabVIEW documentation on the MathScript syntax and the functions themselves to see what differences there are with Matlab. We cannot do this for you. This is something you have to do.
08-19-2010 01:29 AM
hi
thanks for ur reply
i have also studies math script node & it is not similiar you right about that point
iam attaching the new file still facing problem
the math script is not reading the word 'function' which i have used in my matlab
i have reduced it , then i am having the problem of my input name 'ip', that i need to be a vector or array
by basic task is not to use math script,
i want to explian in few line
i have done some task in matlab through .m file, in which iam calling simulink model , where i have used matlab function(the user define program) , in which iam calling the function
first of all i have tried to do it directly through SIT(simulation interface tool kit) & simulation translator, but not succesed
reason
due to the matlab function, which was not converted directly, that's the reason iam using math script node to cope with that problem
iam attaching my word file , in which i have shown my simulink model
my question is now?
could any one help me regarding this problem
is there any tool kit in labview which directly work on my simulink model(shown in word file), or help me in my math script problem
thanks all
08-19-2010 09:03 AM - edited 08-19-2010 09:04 AM
I've already told you, TWICE, what you need to do in order to call your function using the Matlab script node from LabVIEW. I can't help it if you won't do what's necessary. You place your .m file in one of the directories of your Matlab search path, and then you can simply call the function directly, as so:
Note that the output, op, is an array, NOT a scalar. When I do this the Matlab Script node calls your function.
You should be aware that your .m file doesn't work in Matlab to begin with. When I created an array of random numbers for ip and called the "myimplement" function, both Matlab and LabVIEW returned the same error:
Warning: Integer operands are required for colon operator when used as index.
> In myimplement at 9
??? Error using ==> reshape
Size arguments must be real integers.
Error in ==> myimplement at 19
Bzu=reshape(Bzuv,p*l_z,p_c*m_u);% Bzu matrix
This is a Matlab error, not a LabVIEW error.
08-19-2010 10:49 AM