Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/17/2018 in all areas

  1. When you break down your string into different sub-sections, the problem becomes much easier to solve. Don't try to handle 4 delimiters at the same time. The format for the full packet is: !<VOLTAGE_LIST>:<TIMER_LIST><CR> The format for <VOLTAGE_LIST> is: <VOLTAGE_PAIR[0]>;<VOLTAGE_PAIR[1]>;...;<VOLTAGE_PAIR[n-1]> The format for <VOLTAGE_PAIR[k]> is: <VOLTAGE1[k]>,<VOLTAGE2[k]> The format for <TIMER_LIST> is: <TIMER4>,<TIMER5> Notice that: The full packet only has '!' at the start, ':' somewhere in the middle, and '\r' (<CR>) at the end <VOLTAGE_LIST> only has 1 delimiter: ';' <VOLTAGE_PAIR[k]> only has 1 delimiter: ',' <TIMER_LIST> only has 1 delimiter: ',' You can translate the above breakdown into very simple LabVIEW code: Notes: The pink VI is <vi.lib>\AdvancedString\Split String.vi To make it appear in your palette or Quick Drop, install Hidden Gems in vi.lib from VIPM or http://sine.ni.com/nips/cds/view/p/lang/en/nid/212430 Alternatively, you can use OpenG's String to 1D Array.vi Regular Expressions (Regex) are very useful for string manipulations. Play with it at https://regexr.com/ (note: You might need to replace '\r' with '\n')
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.