09-14-2014 07:36 AM
I have an 1D array of elements and I want to muliply all elements of this 1D array with constant number let say 4. So can any body guide how can I multiply all the elements of 1D array with constant number?
Thanks
JK
09-14-2014 07:39 AM
You need to study a basic introductory course to LabVIEW, and read through the manual. It's counterproductive to start asking questions before at least having done that.
09-14-2014 11:34 AM - edited 09-14-2014 12:43 PM
What have you tried? Where did you get stuck?
Ever heard of this function? Try to combine it with this one.... 😄
01-08-2015 05:30 PM - last edited on 01-09-2015 10:03 AM by dcarva
What you might have initially tried was to add a Multiply function (Numeric-Multiply), wired your 1D array to one input, and then tried to create a numeric constant for the other input by right clicking on the node and selecting Create-Constant. Of course, this would have created an array constant, which is not what you want, and the resulting output would not have worked.
What you need to do instead is make your own numeric constant (Numeric-Numeric Constant) and wire that to the other input directly. Then the output of the Multiply function will be your input array times that constant.
01-08-2015 05:55 PM
riraheta wrote:
What you need to do instead is make your own numeric constant (Numeric-Numeric Constant) and wire that to the other input directly. Then the output of the Multiply function will be your input array times that constant.
I discovered this by trial and error, no thanks to the other two conceited pricks who "answered" this question earlier.
Umm, that's exactly what Altenbach suggested. You might note that his links are to the help for "Multiply" and "Numeric Constant." Not sure it could be much clearer than that.
01-08-2015 06:41 PM
01-08-2015 07:22 PM
@riraheta wrote:
Wow all of you people are [smarter than me]. Thanks for nothing.
What you might have initially tried was to add a Multiply function (Numeric-Multiply), wired your 1D array to one input, and then tried to create a numeric constant for the other input by right clicking on the node and selecting Create-Constant. Of course, this would have created an array constant, which is not what you want, and the resulting output would not have worked.
What you need to do instead is make your own numeric constant (Numeric-Numeric Constant) and wire that to the other input directly. Then the output of the Multiply function will be your input array times that constant.
I discovered this by trial and error, no thanks to the other two conceited [crybaby insult] who "answered" this question earlier.
Perhaps you should read their replies before throwing a tantrum. Then, you won't look as foolish. You suggested the same thing they did.
And, let's be fair. If you're unable to understand something this basic, it's not really beneficial to hand you the answer. They NEED to learn how to program if they're going to program. If this is a task that's over their head, they DO need to take courses. It's less than benevolent of you to insult others for pointing this out.
01-08-2015 08:23 PM
Joseph,
I think the following link to polymorphic functions in LabVIEW might clear some things up. This is something that is not immediately apparent to new users.
From the help document:
For operations involving a scalar and an array or cluster, LabVIEW performs the function on the scalar and the respective elements of the structure. For example, LabVIEW can subtract a number from all elements of an array, regardless of the dimensionality of the array.
http://zone.ni.com/reference/en-XX/help/371361L-01/lvconcepts/polymorphic_functions/
01-08-2015 08:24 PM
@riraheta wrote:
I discovered this by trial and error ...
Well, "trial and error" is probably not the right way to learn a new programming language. 😄
In any case, creating a constant on a terminal, if the other terminal is already wired to an array, will create an array constant with the same dimensionality. If you would create a constant first, before wiring to the array, you would get a scalar. You simply need to hook things up in the correct order to minimze the extra work.
I agree that the current behavior is not optimal and that's exactly why I posted this idea about five years ago. Please vote for it! 😄
01-08-2015 09:31 PM
Um, I think my account may have been somehow hacked.... I don't recall postng anything in this discussion... Is there any way to close my account? I fear that my emails may have been compromised. Sorry for any inconveniences.