‎11-04-2015 03:18 AM
Hi there,
So my string has a data size(hex code) of 117824. Now I want to make it of size 118784 so that it is perfectly divisible by 4096. So basically what I want to do is add zero paddings to the empty strings until it reaches 118784. I tried using replace substring but couldn't get the expected results. Thanks!
‎11-04-2015 03:39 AM
I tried using this approach instead but the output was 3030 3030 3030. What I wanted is 0000 0000 0000.
‎11-04-2015 04:02 AM - edited ‎11-04-2015 04:03 AM
Hi keatwk,
when you post images of your BD you should really use Ctrl-U before…
Padding a string can be quite easy:
I tried using this approach instead but the output was 3030 3030 3030. What I wanted is 0000 0000 0000.
That's because you don't know the difference between a byte with value zero and the ASCII char "0"…
‎11-04-2015 12:26 PM
Hi GerdW,
May I know why are you using case structure? Also could I have the vi file (preferably in 8.5). Thanks!
‎11-04-2015 12:50 PM
Hi keatwk,
why are you using case structure?
No need to add 4096 bytes in case the string already has a proper length…
Also could I have the vi file (preferably in 8.5).
Unfortunately I didn't save this little item. It's easy enough to recreate it from scratch - and a nice exercise for you to learn LabVIEW with…
‎11-04-2015 01:07 PM - edited ‎11-04-2015 01:09 PM
@keatwk wrote:
Hi GerdW,
May I know why are you using case structure? Also could I have the vi file (preferably in 8.5). Thanks!
I'm assuming the case structure is for readability. Initializing an array of "Remainder" number of elements and concatinationg that too string should work just as well without the case structure.
Backsaved to LabVIEW 8.5 attached
‎11-05-2015 01:57 AM
My data are in ASCII formats, so inputting 00 doesnt give out 00 hex code. But when I tried inputting "NUL" it gives out something else too. How can I go about this?
‎11-05-2015 02:26 AM - edited ‎11-05-2015 02:27 AM
Hi keatwk,
did you notice the display mode of the string constants in my and Jeff's example image? There's a reason why we explicitely show this setting!
@Jeff: Is there a reason to add 4096 bytes to the string when it happens to have a length dividable by 4096?
‎11-05-2015 03:32 AM
Hi,
This looks like it is related to this thread here
http://forums.ni.com/t5/LabVIEW/split-hex-code-after-every-4096-bytes/td-p/3212543
If you look at my example that I posted you end up with 4096 bytes padded already in one operation...
Craig
‎11-05-2015 04:00 AM