For an example exam question, I've been asked to 'tangle' a string as shown:
This source codes are developed in MATLAB, VHDL, VERILOG and LABVIEW Programming languages. These codes are useful for beginners in the field of signal processing, image processing and communication domain. Scrambler and descrambler, READ MORE. Interleaver and deinterleaver matlab code, READ MORE. Data Modulation, READ MORE. How to write a function to scramble letters? Learn more about matlab function, string, random. How to write a function to scramble letters? Learn more about matlab function, string, random.
I understand this is an extremely simple problem but it's got me stumped.
I can make it produce a tangled word when the length is even, but I'm having trouble when it's odd, here's my function:
If you've waited in vain for a.22 LR version of a favorite centerfire semiautomatic pistol like the Springfield Armory XD, maybe it's time to settle for the Walther P22. Photo by Mark Wynn. Instruction manual for walther p22.
Sardar UsamaFor odd word length, you need to reduce n
by 1
to leave the last char untouched. Use mod
to detect odd word length.
If you want to scramble every char randomly, you can try:
shuffled = 5741326
If you want to change the first two chars:
tangled = 2134567
If you want to change every two chars:
tangled2 = 2143657
Matt