LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MATHSCRIPT in LabView 7.1

Solved!
Go to solution

Hello,

 

How can I use MATHSCRIPT in LabView 7.1 ?

 

thank you

0 Kudos
Message 1 of 16
(3,141 Views)

I don't think it existed with LabVIEW 7.1..

 

I will have to check...  But if I rely on my memory, I think it came out with LabVIEW 8.0.

0 Kudos
Message 2 of 16
(3,139 Views)

Ray is correct that LV 8.0 is the first version that supported Mathscript. I believe ealier versions had the Matlab node, so if you have Matlab, you might be able to convert your code to it. I'm not sure how similar the languages are.


___________________
Try to take over the world!
0 Kudos
Message 3 of 16
(3,130 Views)

Thnk you.

 

Can anyone please help me to convert this MatLab code into LabView ...!

 

stop = 0.001;
start = -0.001;
point = 10;
distance = ( stop - start ) / point;
t = ( start : distance : stop );
t1 = t(find(t~=stop))

 

t1 will give me array of 10 points.

 

thank you.

0 Kudos
Message 4 of 16
(3,107 Views)

I have no idea what the find function does, but if the point is to generate an array of N points from A to B then you can just call the Ramp Pattern VI (search for it in the palette) and if you don't have it, just use a for loop with A+((A-B)/N*i).


___________________
Try to take over the world!
0 Kudos
Message 5 of 16
(3,102 Views)

@winter888 wrote:

Thnk you.

 

Can anyone please help me to convert this MatLab code into LabView ...!

 

stop = 0.001;
start = -0.001;
point = 10;
distance = ( stop - start ) / point;
t = ( start : distance : stop );
t1 = t(find(t~=stop))

 

t1 will give me array of 10 points.

 

thank you.


Is the code below what you are looking for? 

 

I looked up the last function...  Did you want the indices for all values which are not equal to 0.001???

 

 

 

pretend that -5.4E-20 is zero..

0 Kudos
Message 6 of 16
(3,098 Views)

Thanks Ray,

 

Nice code. Is there any way I can make that wired long digit number to zero in my array?

 

And as there should be 10 points, it would be nice if I can delete the last number, which is equal to 'stop'.

 

And that's what I did in my mathscript with 't1'.

0 Kudos
Message 7 of 16
(3,074 Views)

Use Array Subset.

 

Lynn

0 Kudos
Message 8 of 16
(3,070 Views)

There are a few ways of doing this.  The approach similar to:  t1 = t(find(t~=stop)) is not recommended because searching a double or ext precision may not provide a match.  The reason I initially asked about the function is because you mentionned that it returned an array of 10 elements, whereas it really returns 9.

 

Unfortunately, the method shown below is not flexible as it will only remove the last value, which should always be the stop value in this exercise..   You can use Array subset (preferred as Lynn mentionned) or delete from array.  There are other tricks, but I think these 2 are the more efficient ones.

 

 

 

0 Kudos
Message 9 of 16
(3,060 Views)

Like I said before, using the Ramp Pattern VI would be simplest, but you could also do it with the for loop, which will produce simpler code and where you won't need to cut the array, but it will have exactly the right number of points to begin with.

 

As for the long number, the method I suggested might or might not return it as a proper zero (that depends on the way floating point calculations work), but you can at least display it as zero by right clicking the numeric control inside the array, going into the display format page and changing the display format to display fewer digits of precision.

 

To learn more about LabVIEW, I suggest you try looking at some of these tutorials.


___________________
Try to take over the world!
Message 10 of 16
(3,050 Views)