LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2d Array Problem

Hello , I'm little new to labview ,need a help urgent

I have a 2D -array with 1 column and 1000 rows my output type is also a 2D-array, i'm trying to converting all the values here, for example if all my input 2d array values are 200 , i will divide it by 500, so all my ouput array should contain 0.4 ,

but in the output array only the first value is changing to 0.4 and remaining are 200.

I have attached the my VI here CommandFSConversion.vi which is having the sub vi(FSconversionCommand.vi)

Download All
0 Kudos
Message 1 of 12
(2,637 Views)

In the subVI, you are indexing out the first row instead of the first column. Wire a zero to the lower index instead.

 

However, the entire toplevel code seems incorrect. if the input array really only has one column, there is no way to replace any highrer numbered columns, because they don't exist. Don't duplicate all this code depending on the array size. Just autoindex in a FOR loop.

0 Kudos
Message 2 of 12
(2,616 Views)
you don't need a subVI. all you need is the LV divide function. wire your 2D array to the X input, a scalar constant with 500 in it to the Y input and you're done...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 12
(2,611 Views)

@mikeporter wrote:
you don't need a subVI. all you need is the LV divide function. wire your 2D array to the X input, a scalar constant with 500 in it to the Y input and you're done...

Well, he seems to have an array of scale factors so it might e a litttle bit more complicated.

 

Does the size of the array of clusters correspond to the number of columns? A simple FOR loop, autoindexing over the columns (transpose first!) and multiplying with the scale factor will do everything in one step.

 

 

Of course, you seem to do everything on the first column, so maybe you want multiple columns as output, one for each element in the cluster array.

 

Download All
0 Kudos
Message 4 of 12
(2,605 Views)

Thank You so much sir for your response on my issue,

I tried to follow your solution from the second screenshot which you have provided but could not execute it exactly  i'm getting conversion error after Transpose array. then i tried to add dimension to it but got error related to dimensions in my main VI,

Please dont mind if something is wrong from my side.

Attached screenshots

Download All
0 Kudos
Message 5 of 12
(2,582 Views)

Your CMD out is currently a 1D array.  Change it to a 2D array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 12
(2,566 Views)

yes that is the problem if i'm trying to make that 2D i'm getting same dimensions problem in my main VI.

i attached both my main vi and subvi in beginning of the post

0 Kudos
Message 7 of 12
(2,558 Views)

My example does not even use the subVI.

0 Kudos
Message 8 of 12
(2,551 Views)

Sorry i didnt understand what to do with my first VI FSConversionCommand.vi in which i have a case structure, so do u want me to implement similar kind of for loop with autoindex?

0 Kudos
Message 9 of 12
(2,524 Views)

You don't need a case structure here.

0 Kudos
Message 10 of 12
(2,511 Views)