Question: In matlab Write a function shufflestring( pairs, s) that swaps characters of s as specified by the indices present in the pairs variable. pairs is

In matlab

Write a function shufflestring( pairs, s) that swaps characters of s as specified by the indices present in the pairs variable. pairs is a 2-column matrix, where on each row, you are given the positions of the two characters you need to swap. If s is not given, use s='O0O0O0OO000OO0OO0O00OOOOO0OO00O0O00OO0OOO0OO0OO0OOOOO00O0O00000O'

>> disp( shufflestring( [1 2], 'orange') ) roange >> disp( shufflestring( [1 2; 2 1], 'orange') ) orange >> disp( shufflestring( [4 2; 3 4], 'bare') ) bear >> disp( shufflestring( [1 4; 4 6; 5 6], 'looped') ) poodle 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!