LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

query: matlab function

can i use matlab function like angle, ginput into labview?
0 Kudos
Message 1 of 18
(4,838 Views)
If you're running a recent version of LabVIEW, you can probably use some functions like that directly using a MathScript node (or even a MATLAB Script Node in some cases).

But anyway, it looks like the equivalent of the Angle function is in the Mathematics -> Numeric -> Complex palette ("Complex to Polar"); it even appears to take array input.

GInput might be a little more complicated.  You might be able to just use a cursor on an ordinary XY-graph and read its coordinates from a Property Node, depending on what your needs are.
0 Kudos
Message 2 of 18
(4,820 Views)

property node? how do i get this?

after i plot the graph, i click on it and it will get the data for me?

0 Kudos
Message 3 of 18
(4,734 Views)

how to extract data for a particular column from a .txt. let's say i got 5 columns. how to i extract just the 5th column to plot my graph. 

clear all

fid=fopen(relay.txt','r');
g=(fscanf(fid,'%f',[5,inf]))';
status=fclose(fid);

plot( g)

grid
xlabel('Time')                                
ylabel('Temperature')                               
title ('Temperature of bakeplate')

it gives me 5 plots within a graph instead of just one y values.

0 Kudos
Message 4 of 18
(4,733 Views)

@nonmm wrote:

property node? how do i get this?

after i plot the graph, i click on it and it will get the data for me?


Right-click the graph and select Create > Property Node > Cursor > Cursor Position > All Elements.  You can then wire that property node to something else (like an indicator).

You should be able to find more information on how to manipulate graphs using property nodes on the NI website or in the LabVIEW help.


@nonmm wrote:

how to extract data for a particular column from a .txt. let's say i got 5 columns. how to i extract just the 5th column to plot my graph. 

clear all

fid=fopen(relay.txt','r');
g=(fscanf(fid,'%f',[5,inf]))';
status=fclose(fid);

plot( g)

grid
xlabel('Time')                                
ylabel('Temperature')                               
title ('Temperature of bakeplate')

it gives me 5 plots within a graph instead of just one y values.



I don't understand.  Do you want to do this in MATLAB, LabVIEW, or what?

In the example above, I think all you really need to do is replace "plot(g)" with "plot(g(:,5))".
0 Kudos
Message 5 of 18
(4,729 Views)
wow thanks for the plot graph. 🙂
 
for the property node, i try to connect to a input of the mathscript node so that i can use the x-axis i obtain from the cursor to do another calculation.
But i can't seem to connect the output of the property node to the mathscript.
why is this so?
0 Kudos
Message 6 of 18
(4,723 Views)
If you have Context Help open (Ctrl-H), then when you move your mouse cursor over the broken wire in the Block diagram, you will see that the source is a Cluster and the sink is a Double (or 1D array of Double).  That is why that is so.

If you just want the X-coordinate, then instead of selecting the "All Elements" property in the proprerty node, you should select "Cursor X".
0 Kudos
Message 7 of 18
(4,720 Views)
i have tried to unbundle it. but it seems to fail. 😞
0 Kudos
Message 8 of 18
(4,718 Views)
i have attached the file. there is no error when i try to run. but upon running there is an error : Error 1055 occurred at Property Node (arg 1) in cursor_x.vi
0 Kudos
Message 9 of 18
(4,713 Views)
That's probably because your graph doesn't have a cursor!  Right-click the graph, select Properties, click the Cursors tab, and then click Add.
0 Kudos
Message 10 of 18
(4,711 Views)