ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

some strange behavior

I have found something in mathscript that I can't quite figure out.
 
If I define the following:
 
N = 8192
fs = 1.92e9
 
and then generate
 
t = [0:1/fs:(1/fs*(N-1))]
 
I get a array that is only 8191 long instead of 8192 which is what matlab gives me.
 
What is more strange is that if I set N = 1024 then mathscript does in fact give me a 1024 elements. In fact every number I tried around 8192 gave the right result. When I change fs to something else I get the right number too. There is something to the relationship of fs to N which creates a special case that causes a drop of the last element?
 
Thanks
Jeff
0 Kudos
Message 1 of 3
(7,145 Views)
I can reproduce this and think it is a bug. I have reported it in the general bug thread:
 
 
Hopefully somebody from NI will throw in a comment and possibly provide a CAR#. 😉
0 Kudos
Message 2 of 3
(7,123 Views)
Hello Jeff,

You have discovered a bug in MathScript.  I have filed a CAR (#45TCCISF) and it should be fixed in a future release of LabVIEW.  It looks like MathScript is only omitting the calculation of the last element and this is likely a rounding issue.  For a workaround, you could manually compute the last element and append it to the matrix.

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