LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string to number conversion

Solved!
Go to solution
Dears,
 
Please c the attachment and reply me asap.
 
Thanks & kind regards,
Mathan
0 Kudos
Message 21 of 34
(1,849 Views)

Hi mathan,

here it is.

Mike



Message Edited by MikeS81 on 06-13-2008 09:14 AM
Message 22 of 34
(1,841 Views)
Here comes some computing history:
A nibble is 4 bits
A byte is 2 nibbles = 8 bits
A word is 2 bytes = 16 bits
A double word (DWORD) is 2 words = 4 bytes = 32 bits

So your structure will be 8 bytes.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 23 of 34
(1,836 Views)
Dear mike and TonP,
 
Thanks for the responses. I tried with all your suggestions.
 
In the dll call, the return value show some error. kindly see the attachment please.
 
Error: One or more of the supplied parameters are incorrect.
 
Kindly check the dll call and please give me the correct input values.
 
P.S. (msdn.microsoft.com/en-us/library/aa379804.aspx )
 
Thanks,
Mathan


Message Edited by mathan on 06-17-2008 01:57 AM
0 Kudos
Message 24 of 34
(1,806 Views)

altenbach wrote:
There are no string outputs in my solution (not everything that is pink is a string!). For each number, I create an array of U8, and since each can be of different length, I package them into an array of clusters. (If you would autoindex to a 2D array, the short solutions would get padded, something you probably don't want).

Dear altenbach,
 
Thanks for all the replies. Also, now i need to implement another one. Let's say input be 2,1 2010010100 from the text file. I need to convert these into an array of U8. When i tried with ur example, the ',' and ' ' (space) are skipped and it results in an array like this 02012010010100 (omitting , and space).
How to implement this?
Thanks,
Mathan
0 Kudos
Message 25 of 34
(1,798 Views)


mathan wrote:
Thanks for all the replies. Also, now i need to implement another one. Let's say input be 2,1 2010010100 from the text file. I need to convert these into an array of U8. When i tried with ur example, the ',' and ' ' (space) are skipped and it results in an array like this 02012010010100 (omitting , and space).


This is because I read the file as a 2D spreadsheet with space as delimiter, meaning the first colum will have the "2,1" and the second column the "201..." string that is further processed. Since the spaces is defined as delimiter, it is dropped.
 
If you want the entire line as one element, define a diifferent delimiter (e.g. \n).
 
Maybe you should also explain what you mean by U8 array. Just the byte representations of your formatted string?
Message 26 of 34
(1,781 Views)

altenbach wrote:
If you want the entire line as one element, define a diifferent delimiter (e.g. \n).

Dear altenbach,
 
Thanks a lot for the post.
As per the vi attached sending the string '2,' as input, hexadecimal string to number function is converting it to 02 (omitting the ,). Similarly, 1 (1 space) if given as input will return as simply 01 (omitting the space). i need if input string is 2,1 2010010100 the output will be array of U8 values. what am getting now is 02012010010100.
 
Thanks,
Mathan


Message Edited by mathan on 06-18-2008 01:59 AM
0 Kudos
Message 27 of 34
(1,760 Views)
Please attach the VI instead of an image.
 
Since you want the plain string, delete the inner loop and use the raw string directly. Try it!
Message 28 of 34
(1,751 Views)

Dear altenbach,


Please attach the VI instead of an image.

Its actually the vi you posted in this thread named scanhex.vi. so i didn't reattached it.


Since you want the plain string, delete the inner loop and use the raw string directly. Try it!


No altenbach, am not in need of string output. i need the output as 02h, (comma)h, 01h, (space)h, 20h, 10h, 01h, 01h, 00h (all must be U8 values). am attaching vi here. kindly modify please.
Thanks,
Mathan


Message Edited by mathan on 06-18-2008 03:57 AM

Message Edited by mathan on 06-18-2008 04:02 AM
Download All
0 Kudos
Message 29 of 34
(1,741 Views)

Hi Mathan,

Can you attach the file also, or save & repost the VI with default values for the all rows variable?

- Partha ( CLD until Oct 2027 🙂 )
Message 30 of 34
(1,737 Views)