LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how mathscript node work when i have user defiend matlab function

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.

Message 11 of 14
(1,215 Views)

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

Download All
0 Kudos
Message 12 of 14
(1,201 Views)

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.

Message 13 of 14
(1,191 Views)

thanks

 i have sort out  my problem

using math script node\i will answer it also

tc

0 Kudos
Message 14 of 14
(1,179 Views)