LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, formula node

Hi,
 
I am confused now about the formula node. The labview begins with 0, so the angleP is from 0-1023, however, in the Mathscript the index begins with 1. So I should use index k not k-1. But when I use angleP(k) in the Mathscript, the errors says the indexs are out of bounds for the variable you specified cause angleP is from 0-1023.  So that is the problem--how to deal with the different index range problem.
 
I tried to finish this mathematical problem in formula node but there is still error but I do not know where it is wrong. Can you help me to point out the problem in the formula node. Thanks.
 
Huihui
0 Kudos
Message 1 of 10
(3,248 Views)
Can you also show us the mathscript code that gives you errors?
 
Anyway, your formula node syntax seems way off....
  • Array indices go in square brackets (e.g. "AngleP[k]")
  • you are operating in 1D arrays with 2D indices.
  • ...

It is not clear enough what you actually want to do with all this. Can you show us some formulas? How big is the input array?

0 Kudos
Message 2 of 10
(3,238 Views)
Part of your confusion stems from the fact that the Formula Node and Mathscript are two different things. The Formula Node is for entering text-based code in a C-like syntax. The Mathscript node is for entering code using NI's Matlab-like language. Based on your description it's not clear to me which one you want to use. It's also not clear to me why you even need to use either, as a glance at your code seems to indicate you can write the code using LabVIEW functions.
0 Kudos
Message 3 of 10
(3,216 Views)
Hi,
 
Thanks for your reply.
 
I know the difference between the formula node(C like language) and Mathscript (Matlab like language). Firstly I used the Mathscript see attach file 1, which can not finish my task due to the conflict between the fact that the index in labview begins with 0 while that in Mathscript begins with 1. In fact,  I wanna get the magnitude and phase first then do some mathematical calculation to get the real part and imaginary part. In this case, I am not sure about if there are some exsited labview function to deal with it.
 
Thanks,
 
Huihui
0 Kudos
Message 4 of 10
(3,190 Views)
In this post and in an earlier one on the same subject, it has been mentioned that your array indexing is all wrong. You have something like (m+1, k) which would imply a 2D array but that is not what you are inputting - it's a 1D array. It's like you've copied these formulas from somewhere and have no idea how they are supposed to be used. Your problem has nothing to do with where the array index starts.
0 Kudos
Message 5 of 10
(3,184 Views)
Hi,
 
Thanks for your reply.
 
The attach file 1 is the vi with Mathscript node. The quetion here is the Mathscript begins with 0 while the labview begins with 1. So I do not know how to get the first signal from angleP in the Mathcript. So I tried to use the formula node but there are still some errors. I changed the array expression with square bracket, see the attached file 2. The input signal is from 0-1023.
 
For the problem of operating 1D array in 2D, I think it is ok cause I wanna produce a matrix with m 1D array with the length of 1024, m is the number of the rows and k is the number of the signal per row.
 
What I wanna do is to get the magnitude and phase signal then do some mathematical calculation to get the real and imaginary parts.
 
Thanks for your sincere help. I notcie that you are the kind person who replied my question before. 
 
Huihui 
 
 
Download All
0 Kudos
Message 6 of 10
(3,179 Views)
Hi Dennis & hxwgter,

here's the link to the older thread containing some more vis...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 10
(3,176 Views)
You haven't changed a thing. There is nothing with square brackets and even if you changed to square brackets, you CANNOT have [m+1][k]. That is the notation for a 2D array and you are operating on either a 1D array or a scalar. For example you define AngleP as a float 64 but then you seem to apply some sort of array indexing to it (AngleP(m+1,k). That makes no sense. What exactly are you trying to index out of the input arrays? What is m+1 and k supposed to represent? Where did you get this equation.
0 Kudos
Message 8 of 10
(3,165 Views)

Hi,

Thanks for your reply. Sorry about postering the wrong vi so it seems that I did nothing. I have solved the problem in the formula node. Thanks.

 

Huihui

0 Kudos
Message 9 of 10
(3,106 Views)
Hi hxwgter,

I'm really interested in your (working) vi. What is the result of all those questions?

Huihui ???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 10
(3,100 Views)