LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Conversion, Please help

Hi GerdW,

 

Sorry I posted the empty one. I did test valid array from my program and the indicator is very wierd. Then I tried different inputs and then use control to test. It didnt turn out right for me. For example I put value "10" into array and the converted value isnt 10... Maybe I did something wrong though. Could you explain it to me?

 

Thanks

0 Kudos
Message 11 of 21
(1,230 Views)

Hi Tony,

 

just for curiosity: Did you input that "10" into the the element of the array or did you write that number into the index of the array? That's quite a difference... Smiley Wink

 

Please attach a VI with real data and your (supposed) weird result...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 21
(1,224 Views)

tony353 wrote:

I'm trying to extract data from excel file ( which is 1-D array of long) ,(one number at a time, not a row) to trigger a case structure. Even I use "to long integer" it says the format is 1-D array of long integer. So I need to convert that specific number in 1-D array form to integer.


Case structures don't accept arrays, just scalars. So if you have a long array of DBL, "converting" to a scalar I32 is NOT a conversion, but a very lossy data reduction. Taking the average as mentioned would be one possiblity, but would not make a lot of sense in general, because there are so many possible outcomes and you probably don't want to have thousands of cases in the case structure.

 

Since you say you want to do it "one number at a time", you are no longer having an array, and a simple "to I32" would suffice. Maybe all you need to do is wrap a FOR loop around it???

 

Can we reboot this discussion and start from scratch:

  • Can you attach a typical array?
  • What kind of cases do you need to handle?
0 Kudos
Message 13 of 21
(1,221 Views)

Ok.. Heres the code.. After clearing irrelvant stuff, I need to convert the output of the read excel file( that long orange line) from array format to integer...

 

Heres the probem: After using I32, it still says incompatiable as still in 1-D array format.

 

I need that line from 1-D array format to non array in order to control case structure and do comparison and so on.

 

and Thanks for really quick reply from you. Thank you.

0 Kudos
Message 14 of 21
(1,216 Views)

I don't see any case structure (except the error one).

What should the cases be? You have not explained the need for a case structure and how it should depend on the data in the orange array. Should it depend on the first element? on the array size? something else?

 

There is still a lot of irrelevant stuff. What's up with that giant "index array"? If you want the elements in order, the indices don't need to be wired.

0 Kudos
Message 15 of 21
(1,209 Views)

Hi Tony,

 

as said before: use autoindexing and "to I32".

check.png

And give some thoughts to Altenbachs comments on your problem...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 21
(1,210 Views)

The value from excel file is ranged from 1-100. (integer)

 

The case structure(which the orange line is heading) going to be 4 ranges, 1-20, 21-50, 51-70 and 71-100.

 

the giant "index array" is extracting a lot of excel file values, I just showing one line for conversion into integer.

0 Kudos
Message 17 of 21
(1,208 Views)

Hi GerdW

 

Can you please explain what is autoindexing and how it should be used?

Sorry I dont understand that.

 

Thanks and Best Regards.

0 Kudos
Message 18 of 21
(1,205 Views)

Hi Tony,

 

when you don't know the term "autoindexing" you should definitely go through the LabVIEW Basics course offered by NI...

 

Did you notice the input tunnel of the FOR loop? It's colored different than other tunnels - and there's a reason for...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 19 of 21
(1,201 Views)

Ok I do notice..

 

I learn labview from school and none of the lecturer teach autotunneling...

 

Would you be kind enough to tell me how to make autotunnel? it will take really lot of time for me to find it in the courses.

 

Thanks

0 Kudos
Message 20 of 21
(1,195 Views)