04-02-2009 06:53 PM - edited 04-02-2009 06:54 PM
hi,
i am learing labview and i wanted to do something like this..
i want to read in a text file.
convert the decimal numbers to binary numbers
and then add leading zeros if the lenght of the binary is less than X number.
and then ultimately sum up all binary numbers and parse it into 1 bits as 1 array.
the reason for me doing this because i am generating a singal.
i have started on this, but i am stuck at the comments, can someone help me out.
thank you in advance..
Solved! Go to Solution.
04-02-2009 09:15 PM - edited 04-02-2009 09:18 PM
The Format Into String Function will do this for you. Right click and change the options to pad with zeros.
04-03-2009 02:46 AM
I am having problems with your terminology, especially since the VI you have attached seems t do something else.
04-03-2009 09:50 AM
paulmw, thank you..that advice works like a charm.
hmm...my vi shows the summing up of the string lenght because I wanted to verify that i get about 1690 bits for 64*26 bits and about 64*27=1728 bits.
that help me verify that the signal i am generating from the text file is equal to the signal from ni-6534 card.
binary numbers to me are numbers of 1s and 0s, 01010101, etc.
binary numbers in string let me count the numbers of bits? or is there an easier way?
with that in mind, i want to sum up all the resulting string into 1 big array of 1728 bits...then parse each bit up...
lets say i have 10101
i want to make it
array1=1,0,1,0,1?
04-03-2009 10:03 AM
i think i am doing it right?
my concept of generating a signal from a text file?
i am still missing one thing...
parsing out bit by bit into an array of 1728bits...
04-03-2009 10:17 AM - edited 04-03-2009 10:26 AM
04-03-2009 10:32 AM
OKAY..I GOT IT..THANK YOU GUYS FOR ALL YOUR HELP...
I REALLY APPRECIATED!!!
04-03-2009 10:55 AM
Can you show us your final version? Your v6 is sitll an absolute mess. 😉
Most of your code is very inadequate and overly complicated. None of your shift registers make any sense, you can delete the (1) shift registers, (2) index array, (3) insert into array (4) initialize array, etc. and replace all with two simple autoindexing tunnels.
I still don't quite understand what you need, but my best guess is that it can be done with code the size of a postage stamp.
To count the number of "1" bits in an array of numeric intergers, you can use e.g. a 16 bit lookup table, no strings or formatting operations needed. It will be many orders of magnitude faster and simpler. All you need is blue wires.
Please show us the final version that gives the correct and desired result so we can show you how to do this right. 🙂
04-03-2009 05:11 PM
altenbach wrote:Please show us the final version that gives the correct and desired result so we can show you how to do this right. 🙂
I agree. Great to hear that you got it working but I kind of expected to see more follow up questions addressing the same things that Altenbach already pointed out. Lets see what you got!
04-04-2009 12:35 PM
i would love to...
that's why i am here.
i want to learn labview the easy way.
i really think the code could be done in an easier way.
i like to use alot of indicators on my block diagram because i like the see results of all manupilations, but besides that..i think that its too complicated as well.
i have a comment on the block diagram.
i need to reverse the order of the binarys before padding the leading 0s.