11-20-2017 01:52 AM
Hello,
I have a numeric control and an array. I want read (by index array) from index 0 to index= number in a numeric control.
I can't have a loop because i want create a subvi with the block diagram.
How can I do this?
Thanks.
11-20-2017 02:20 AM
@cristina.lopez wrote:
I have a numeric control and an array. I want read (by index array) from index 0 to index= number in a numeric control.
I can't have a loop because i want create a subvi with the block diagram.
You'll need to be a bit clearer.
>I have a numeric control and an array.
That's clear.
>I want read (by index array) from index 0 to index= number in a numeric control.
That's not clear. You want to read an array subset from 0 to the number in a control? So, read the control value, and use array subset to get the subset from 0 to the number.
>I can't have a loop because i want create a subvi with the block diagram.
This doesn't make much sense either. You can use a loop in a sub VI.
11-20-2017 08:11 AM
I agree with Wiebe (I do that a lot!) that I also don't understand why you are having trouble. I think you probably have some code that illustrates what you are trying to do (and, possibly, trying to put into a sub-VI), but there are a number of "unclarities" (I don't think that is really a word in English) in your Post that would be "clarified" (now, that is an English word) by your posting a VI that shows what you are trying to do. Questions in particular: What do you mean by "read (by index array)" -- is this File I/O, DAQmx Read, or something else? What do you mean by "create a subvi with the block diagram" -- is this using "Create SubVI" in the Edit menu?
Bob Schor
11-21-2017 01:10 AM
Yes, i want to read an array from 0 to the number in a control, and i'm using a index array fuction, but, how i do that the fuction reads firstly 0 then 1 then 2 .... to five por example. (Imagine taht the numero control is 5)
It is possible to create a Sub.Vi with for loop inside?
11-21-2017 01:37 AM
Hi cristina,
It is possible to create a Sub.Vi with for loop inside?
Yes!
Use an autoindexing FOR loop with your MAX value wired to the N input…
I strongly suggest to take the free learning stuff offered by NI to learn basic concepts of LabVIEW like autoindexing loops…
11-21-2017 02:38 AM - edited 11-21-2017 02:39 AM
@cristina.lopez wrote:
and i'm using a index array fuction
Question remains: why? "Array Subset", "Delete From Array" and even "Split Array" and "Reshape Array" do that (use the first or second). No need for a loop.
And since you don't need a loop, you might not even need a Sub VI. Nothing necessary wrong with a single function in a Sub VI though...
cristina.lopez wrote:It is possible to create a Sub.Vi with for loop inside?
There is nothing you can put in a VI that prevents it from using it as a Sub VI. At least nothing to be concerned about. Some things would be silly, but a for loop definitely is not.
Doing the (free) courses will help indeed.
Posting (a subset of) what you have might help too.
11-21-2017 04:47 AM
If this is some course and the assignment is to get X numbers from an array, Array Subset is the tool.
/Y