LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read array data

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.

0 Kudos
Message 1 of 7
(3,399 Views)

@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.

 

0 Kudos
Message 2 of 7
(3,391 Views)

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

0 Kudos
Message 3 of 7
(3,338 Views)

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?

0 Kudos
Message 4 of 7
(3,313 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 7
(3,305 Views)

@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.

Message 6 of 7
(3,300 Views)

If this is some course and the assignment is to get X numbers from an array, Array Subset is the tool.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 7
(3,287 Views)