04-04-2014 09:19 AM - edited 04-04-2014 09:21 AM
@Thoric wrote:
However, the expression node doesn't accept arrays, so how can you use this command?
Yes it does!
I actually use it quite often for small transformations such as this.
04-04-2014 09:39 AM - edited 04-04-2014 09:43 AM
I get a specific error "Array Operation not allowed here" when using the array dimension size function sizeOfDim. I can't find any help on how to use this function, other than this which isn't helpful, so advice is much appreciated!
I'd expect to be able to pipe an array in and get a scalar out representing the dimension size (in this case an NaN because I've asked for the second ("1") dimension of a 1D array by accident).
04-04-2014 09:45 AM
Try "x+sizeOfDim(x,0)"
Richard wrote "I'd expect to be able to pipe an array in, and get a scalar out---"
I, on the other hand, would never expect the datatype to change in an expression node.
04-04-2014 09:53 AM
An expression node can't change the data type. This is because it is actually x = f(x), where f(x) is whatever you put inside of the expression node. So array in, array out.
04-04-2014 10:11 AM
@JÞB wrote:
Interesting thread. Witch prompted me to scan through some of the less frequently used menu items and generated a possible "Feature" request.
View>>Getting Started Window...
While I'm thinking of this thread-----
Change Getting Started Window Behavior When opened from View>>Getting Started Window.
Don't delay Vote today!
04-04-2014 10:49 AM
@JÞB wrote:
Try "x+sizeOfDim(x,0)"
Nope.
Richard wrote "I'd expect to be able to pipe an array in, and get a scalar out---"
I, on the other hand, would never expect the datatype to change in an expression node.
I can see that it shouldn't change now, given x = f(x) is the rule (Thanks Tim).
But the help explicitely lists sizeOfDim as a valid function and I cannot get it to work. Maybe this isn't supported in the expression node? Afterall, if it can't return the value as an output then I don't see it has much use anyway.
04-04-2014 11:34 AM - edited 04-04-2014 11:34 AM
@Thoric wrote:
@JÞB wrote:
Try "x+sizeOfDim(x,0)"
Nope.
But the help explicitely lists sizeOfDim as a valid function and I cannot get it to work. Maybe this isn't supported in the expression node? Afterall, if it can't return the value as an output then I don't see it has much use anyway.
Can't add a scaler with an array in an expression node. It isn't like the LabVIEW primitives that are fully polymorphic like that. When dealing with the expression node and the formula node, you need to go back to your C programming thought process.
I'm not able to come up with any good way to use the sizeOfDim in the expression node. But it also works with the Formula Node. And since both nodes use the same functions (possibly even use the same code under the hood), then it is automatically in the Expression Node.