05-01-2011 09:56 PM
Hi ,
I was wondering if someone is still awake and can help me out here. I am trying to do Right Shift operation on the attached values. I need to shift the values by 2 places to the Right.
for example, 1110011011111 will become 0011100110111.
meaning add two 0 at the front and remove the last 2 digit.
05-02-2011 12:01 AM
Do you want to do this shifting on your string data which is a set of 1's and 0's you are displaying? Or do you want to convert these 1's and 0's to a numerical value such as in a 16 bit integer (since it looks like you have 13 1's or 0's in each line) and do the bit shifting on the numeric value?
If the former, convert the string to an array (Spreadsheet string to array), autoindex it through a For Loop, and do string operations on it it to peel off the data you want and concatenate "0" characters to the front.
If the latter, use Scan from String on the String palette, to convert it to a U16, then use Logical Shift on the Numeric / Data Manipulatin palette.
05-02-2011 12:10 AM - edited 05-02-2011 12:11 AM
Is that your actual data? A sequence of the characters "1" and "0" (not the actual numbers 0 and 1), with tabs in between? The Logical Shift function only works with numbers. So, if that's your actual data, you first need to convert it to an array of numbers, and then you can use the Logical Shift function. You can convert the string to an array using the Spreadsheet String to Array and then use Scan From String to convert the sequence of character to a number.
EDIT: Was creating my response while RF was posting his reply.
05-02-2011 11:04 AM
Hi,
I tried the solution from Smercurio, but cannot get things rigth. Any further help?
05-02-2011 11:07 AM
Post your VI so we can then see what you did wrong.
Also, before saving it, put the data into your string control and choose Save Values as Default, so we have real data to work with.
05-02-2011 11:10 AM
If I had to make a guess, you probably entered the "\t\t\t" as normal text, rather than as '\' codes. If you did, right-click on the string constant and select '\' codes. You'll see two backslashes in front of each "t". Remove one from each.
Just a guess, but a pretty educated guess.
05-02-2011 02:15 PM
Yes, I did so, but I cannot still get it right.
05-02-2011 02:15 PM
Here is what I did.
05-02-2011 02:58 PM
Changing your delimiter string from \t to \t\t\r as smercurio_fc pointed out should get you there.
JohnCS
05-02-2011 03:08 PM
@gembo wrote:
Here is what I did.
Your data has 3 tabs between numbers, not one. That's why I indicated "\t\t\t", and not "\t". I wasn't stuttering.