LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create 2D array of 1D aray of String

Dear All,

Can any one pls tell me how to Create "2D array of 1D array of String"?

I think i need to create a Cluster of 1D array of String and then put that Cluster in a 2D array.

But i am not getting how to insert values to it.

 

Thanks,

Ritesh

 

0 Kudos
Message 1 of 34
(10,446 Views)

I am not sure that I fully understand your question, but your solution does not sound like a good idea.

 

Two functions jump to mind:

 

* Reshape array will allow you to change a 1D array into a 2 D array (example: 6-element 1-D into a 2x3 2-D)

 

* Build Array will turn the 1D array into a 2D (example: (6-element 1-D into a 1x6 2-D)

 

 

0 Kudos
Message 2 of 34
(10,438 Views)

Dear 10things,

I think you didn't get my question.

The Solution you suggestd will change the Dimension of the Array.

I dont want to reshape or convert 2d to 1D.

I want to have 2D array of 1D array of String.

 

In C/C++, i do it like:

Create a 2D array of Structure. and the Structure consists of 1D array of char String.

 

I hope you get it right this time.

 

Thanks,

Ritesh

0 Kudos
Message 3 of 34
(10,436 Views)
  1. Place an array control on the front panel.
  2. Resize the index so you get two index controls. This gives you a 2D array.
  3. Place a cluster control inside the array so you have a 2D array of clusters.
  4. Place an array control inside the cluster.
  5. Place your data element (string control) inside this new array control.
 You now have a 2D array of clusters (structures), where each structure houses a 1D array of string. If you are unclear about any of the steps above, please read the LabVIEW Help.
Message 4 of 34
(10,420 Views)

I did the same thing as you mentioned.

But, i am falling short in the block diagram panel. I am not getting how to write data to it .

Could u pls write a small example to show how to do it?

 

Thanks,

Ritesh

0 Kudos
Message 5 of 34
(10,408 Views)

Here's a quick draft. See if this helps.

 

(primitives are "index array", "replace array subset", "unbundle by name", "bundle by name".)

 

(A better way might be to use the "in place structure")

 

Message Edited by altenbach on 09-27-2008 12:00 PM
Message 6 of 34
(10,404 Views)

Well, that kind of depends on what part you're trying to write. Since you have a 2D array of clusters, and each cluster contains a 1D array of strings, you can either be writing an element of the 1D array of strings or one of the clusters. Attached is an example.

 

Was just about to post it when I got the notification of altenbach's message. Well, that should give you an idea of what to do. Smiley Wink

Message 7 of 34
(10,398 Views)

altenbach wrote:

(A better way might be to use the "in place structure")


And here's an example for that:

 

 

This is not available in older LabVIEW versions.

Message Edited by altenbach on 09-27-2008 12:06 PM
Message 8 of 34
(10,397 Views)

Hi,

Thanks alot for your Help.

I hardly had any idea about "in place structure". This thing just works amazing.

 

But, just a bit of query left now.

If i dont initialize the Array, it doesn't put any value into it. 

Is there a way that array allocates memory at runtime rather than initializing it with a magic number ?

 

Thanks,

Ritesh

0 Kudos
Message 9 of 34
(10,340 Views)

And yes one more thing.

Is it advisable to use Local variables or shift registers ?

Which is more time efficient ?

 

Thanks,

Ritesh

0 Kudos
Message 10 of 34
(10,337 Views)