Try this.
shuffletext2([1 2; 3 4; 5 6], 'orange')
function [intext] = shuffletext2(pairs,intext)
for p = 1:size(pairs,1)
intext(pairs(p,:)) = intext(fliplr(pairs(p,:)));
end
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!