LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

mathscript output is not displaying

hi,
 
I am trying to do this comparison (Voltage ==> Angle).
I tried to do this using the case structure and it becomes very complex as there are many comparisions involved, so i switched to using mathscript as i tested my data in matlab so i have the code for that.
 
I have attached my VI,matlab code and the data i am trying to interpret.
 
Aim: I am trying to get back the angle reading from the voltages A and B : column 1= degree, column 2= voltage A (va), column 3= voltage B (vb) 
        This data is there in the excel file. Mean data(final).xls
 
Procedure:
  • I am just entering the value of the voltageA and VoltageB in VI (Which you can get in the excel file, choose any voltage A and corrosponding VoltageB )
  • Mathscript node just does the comparision
  • Output is the ans, which is a scalar value (We should get back the corrosponding degree (Approximat) for the voltages entered)
  • I need to indicate that angle in the guage.

Problem: I am not getting any output!!

PS: I have changed the extension of the matlab code (angle_cal_final.m) to txt. Please save it as *.m when trying to run it.

 

RasSmiley Sad

 

0 Kudos
Message 1 of 5
(3,182 Views)

hi guys,

I have figured out what was the problem there.

Mathscript in labview does not detect asind  which gives the angle in degrees. It detects asin which gives you angle in radians. Best way out of it is to determine angle in radians and then convert it in degrees by multiplying it by (180 / pi ).

Smiley Happy

ras

0 Kudos
Message 2 of 5
(3,171 Views)
Hello Ras,

In LabVIEW 8.0 and 8.2, the MathScript node did not have automatic error handling.  This means if the node produced an error and the error out was not wired, the error would be silently ignored and outputs would not return anything useful.  Your VI was saved in 8.0, so I assume you are using this version.  Try creating an error out indicator from the MathScript node.  As you discovered, it will complain about asind and, if you fix that, acosd.  LabVIEW MathScript does not support these functions.

There is the same problem with your angle_cal_final.m file.  In addition, the xlsread function is not supported.  There are other functions to support reading formatted data, though.  Look at cvsread or dlmread.  You will need to export the Excel data to a textual format first, though.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
Message 3 of 5
(3,151 Views)

hi grant,

thanks for the advice and will read more about the mathscript...:-)

where can i find the list of commads whic are detected by mathscript?

 

Ravi

0 Kudos
Message 4 of 5
(3,144 Views)
Hello Ravi,

The easiest way to view a list of available functions is to browse the LabVIEW help.  Go to Help >> Search the LabVIEW Help.  In the Index window, type MathScript.  Click on the "classes of functions" topic that comes up.  This will show a list of all the classes of MathScript functions.  Click on each class name for a listing of functions in that class.

If you are using the MathScript Window, you can simply type "help classes" to bring up a list.  In LabVIEW 8.2 and 8.5, the list appears in the LabVIEW help as above.  In 8.0, it shows a textual list in the MathScript Window.  Typing "help <classname>" (e.g. "help vector") will show a textual list of functions in that class.

For more help on LabVIEW MathScript, check out the LabVIEW MathScript forum.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments

Message Edited by GrantM on 08-30-2007 02:38 PM

0 Kudos
Message 5 of 5
(3,138 Views)