From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

string or hex number split/divide in same number.

Solved!
Go to solution

hello everyone,

im receiving 12 character string from the sensor which is changeable after every read( For example ) 04C613E81E00. i just want to divide it separately in three equal part such as 04C6, 13E8, 1E00(1st part 04C6, 2nd part 13E8, 3rd part 1E00). can someone tell me how to do it? i tried with split string but as it is changeable data im not able o do it with split string.

 

Thank you in advance 🙂

 

 

0 Kudos
Message 1 of 27
(1,725 Views)

Hi 123,

 


@newmemeber123 wrote:

im receiving 12 character string from the sensor which is changeable after every read( For example ) 04C613E81E00. i just want to divide it separately in three equal part such as 04C6, 13E8, 1E00(1st part 04C6, 2nd part 13E8, 3rd part 1E00). can someone tell me how to do it? i tried with split string but as it is changeable data im not able o do it with split string.


What have you tried with SplitString that "does not work"?

 

I recommend to use ScanFromString with a format string of "%4s%4s%4s":

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 27
(1,723 Views)

thank you so much. i tried the same %4, %4,%4 was missed, silly mistake thank you

0 Kudos
Message 3 of 27
(1,711 Views)

Or if you need numerics in the end...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 27
(1,687 Views)

Thank you both. its working.  I have another question i have converted these numbers to decimal and i have to compare these three number with another decimal number separately with less than sign and if it is less than it then that case should execute.... should i use the the case struct or something new you will suggest? because it is showing error while i use case structure.

screenshot is attached of my try.

0 Kudos
Message 5 of 27
(1,675 Views)

@newmemeber123 wrote:

Thank you both. its working.  I have another question i have converted these numbers to decimal and i have to compare these three number with another decimal number separately with less than sign and if it is less than it then that case should execute.... should i use the the case struct or something new you will suggest? because it is showing error while i use case structure.

screenshot is attached of my try.


When you compare one array to another, you get an array of results.  You cannot use an array of results for your case selector.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 6 of 27
(1,673 Views)

thank you.

can you suggest me please? How can i compare these numbers and if they are lesser other then next condition should execute.

looking forward to your help 

thank you 🙂

0 Kudos
Message 7 of 27
(1,667 Views)

@newmemeber123 wrote:

thank you.

can you suggest me please? How can i compare these numbers and if they are lesser other then next condition should execute.

looking forward to your help 

thank you 🙂


You should probably have 3 case structures.  Depending on what is happening in them, you could use a FOR loop to only execute the case if that value is less, using the i terminal as an input for whatever is happening inside of the case structure.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 27
(1,660 Views)

thank you..do you have a similar example ? or link of similar example? 

0 Kudos
Message 9 of 27
(1,631 Views)

@newmemeber123 wrote:

thank you..do you have a similar example ? or link of similar example? 


What are you actually trying to do with these case structures?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 27
(1,625 Views)