LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NUMBER TO STRING, STRING TO NUMBER


@crossrulz wrote:

@JensG69 wrote:

wiebe@CARYAFormat Into String is usually the end point, as it's much more flexible. But not always. I'd slightly prefer Number to Hex String over Format Into String, if it fits the job.

But it (ie Number to Hex string) does not do the job - in this case.


Correct.  And the Number To Decimal String will fill the string width with spaces instead of 0s.  So Format Into String, or even Format Value, inside of a FOR loop would be the way to handle arrays to get what the OP is asking for.


Or Array To Spreadsheet String? Haven't actually open OP's VIs (EDIT:in LV2013 at the momentas there isn't any), but sounds like a fit.

 

I think we're mostly creating our own party here. Is OP still there?

0 Kudos
Message 11 of 18
(1,531 Views)

SHOULD BE IN STRING

0 Kudos
Message 12 of 18
(1,514 Views)

EMWE.jpg

 

IM TRYING TO GENERATE SERIES OF EXCEL FILE(.xls) ACCORDING TO HOW MANY I WANT. (SERIES FILENAME.)

 

THAT ENCIRLCE IMAGE IN THE PICTURE IS THE SUFFIX OF THE FILENAME.

I NEED 3 CHARACTER LIKE; 001,002.....010,011...100,101 AND SO ON

 

EXAMPLE:

I NEED TO GENERATE 69 PIECES OF EXCEL FILE(.xls),THE FIRST 5 CHARACTER IS "XXXXX" THE FILENAME SHOULD APPEAR LIKE THIS XXXXX001,XXXXX002 UP TO XXXXX069

 

THANKS FOR YOUR ANSWERS BTW.

 

0 Kudos
Message 13 of 18
(1,511 Views)

Please check your keyboard.  Something is wrong with it.

 

Your Caps Lock seems to be stuck on.

0 Kudos
Message 14 of 18
(1,502 Views)

hi...

 

Try this VI, i have attached below

Generate File Name.JPG

 

 

S Boopathy Raja

Certified LabVIEW Developer

0 Kudos
Message 15 of 18
(1,500 Views)

@பூபதிராஜா wrote:

 

Try this VI, i have attached below

 

 


Here's a much simpler way.

 

MakeFileNames.png

 

Of course there is also this function.

 

 Some glaring problems with your code:

  • Terminals belong outside the loop, because their data should remain constant during the duration of the loops (if they would change in the middle of execution, the output is unpredictable. They should be read exactly once, and not over and over. This is also a performance issue.
  • Your code will run forever and your computer will run out of memory if the number of digits entered is zero or negative.  If the "number of files" value contains more digits than would fit into the suffix, the VI also cannot terminate because "equal" never happens. Any reasonable programmer would use a "greater or equal" instead of the "equal" here.
  •  ...

 

 

Message 16 of 18
(1,472 Views)

@altenbachAny reasonable programmer would use a "greater or equal" instead of the "equal" here.

 


Absolutely true. But only if a For Loop is not possible. As implied in your example, but just to emphasize that.

 

I'd always prefer a For loops over a While Loop. It's usually much clearer to see when they will run infinitely (never), and will cause problems in less situations, but a While Loop will have the same problem in those situations (for instance when wiring a double +inf to 'N').

 

Since we have the conditional stop terminal, the only reason to use a while loop is when it actually has to run infinitely, or when the number of iterations is determined in the while loop. In all other situations, use a For Loop. Basically, the For Loop is a While Loop with an implemented maximum nr. of iterations, and therefor much less error prone.

0 Kudos
Message 17 of 18
(1,422 Views)

Hello Altenbach,

Let me correct the problems as u mentioned in the reply.

Thanks

 

 

S Boopathy Raja

0 Kudos
Message 18 of 18
(1,372 Views)