04-06-2010 11:12 AM - edited 04-06-2010 11:13 AM
Hi,
I am trying to read from a spreadsheet.
PressDir=-1,1,-1,1
how would I make this work?
I think my conversion code is wrong.
But I have tried everything.
Solved! Go to Solution.
04-06-2010 11:17 AM - edited 04-06-2010 11:21 AM
Try wiring an empty array of the correct dimensionality (1D?) and datatype (U8?) to the "array type" input in the lower left.
(You can also hover over the broken wire to get more information on the problem. Most likely, you get a 2D array by default. You are also not telling us what the datatype of the cluster component PressDir is. Is it a 1D array? This is impossible to solve from the current picture, but the above is probably a good guess at a possible solution. Next time, attach the actual VI to make things clearer).
04-06-2010 11:33 AM
the "PressDir: does looks like a 1D array from the attached picture to me...
Guru
04-06-2010 11:40 AM
Guruthilak wrote:the "PressDir: does looks like a 1D array from the attached picture to me...
04-06-2010 12:58 PM
Judging from your screencapture, it looks like you want your variable "PressDir" to be represented as an iteger. Therefore, I assume you want to be able to read in a spreadsheet string as a boolean array, and then format the boolean array into an integer. (i.e. the array [1,0,0,1] would translate to the number 1001 in binary, or 9 decimal).
Here is one way of acheiving that result:
Hopefully that helps. Good luck.
04-06-2010 01:15 PM
04-06-2010 02:27 PM - edited 04-06-2010 02:28 PM
TurboPhil wrote:Judging from your screencapture, it looks like you want your variable "PressDir" to be represented as an iteger. Therefore, I assume you want to be able to read in a spreadsheet string as a boolean array, and then format the boolean array into an integer. (i.e. the array [1,0,0,1] would translate to the number 1001 in binary, or 9 decimal).
04-06-2010 04:23 PM
Ravens Fan wrote:
You can remove the For Loop from around your step 3 and the code will still work.
Not with that equality to a floating point it won't.
Do I have another nickel in my retirement fund? Looks like I made a dime today!
04-06-2010 04:29 PM
smercurio_fc wrote:
Ravens Fan wrote:
You can remove the For Loop from around your step 3 and the code will still work.Not with that equality to a floating point it won't.
Do I have another nickel in my retirement fund? Looks like I made a dime today!
True, but that's a different problem. I was going for the "don't need to loop through something when the operator also operates on arrays" point. 🙂
04-06-2010 04:31 PM
I think scanning a 1 digit integer into a DBL is probably safe here, loop or not. Equality problems only occur with non-integers and results of computations.
Still, the DBL array allocates 8x more memory than needed to solve the problem.