Prev: Simulink Pulse Generator with amplitude between -1 and +1
Next: How to pass white gaussian noise through a filter
From: Chris on 10 Feb 2010 21:51 I am trying change a value based on its position relative to a zero spaces = (str == ' ') % returns 1 at all blank spaces now I would like to change every position directly after the 1's. I'm trying to use: str(spaces) = (str(spaces))+'a'-'A' but this only changes the blank positions (the 1's)... Can someone help me?
From: ImageAnalyst on 10 Feb 2010 22:15 Chris : You didn't say what you want to change the position after the space to. So in this example, I just changed to the character to "X." str = 'The quick brown fox jumped over the lazy dog.' spaces = find(str == ' ') % returns 1 at all blank spaces str(spaces+1) = 'X' str = The quick brown fox jumped over the lazy dog. spaces = 4 10 16 20 27 32 36 41 str = The Xuick Xrown Xox Xumped Xver Xhe Xazy Xog.
From: Walter Roberson on 10 Feb 2010 22:18 Chris wrote: > I am trying change a value based on its position relative to a zero > > spaces = (str == ' ') % returns 1 at all blank spaces > > now I would like to change every position directly after the 1's. > I'm trying to use: > str(spaces) = (str(spaces))+'a'-'A' > > but this only changes the blank positions (the 1's)... Can someone help me? str([false spaces(1:end-1)])
From: Chris on 10 Feb 2010 22:38 thanks for the help I am trying to make the next letter capital without using "uppers" so far I can only change all the letters to a different letter...
From: Chris on 10 Feb 2010 22:48
figured it out ended up using: str(spaces+1) = (str(spaces+1))+'A'-'a'; %capitalizes the first letter of each word str(1) = str(1)+'A'-'a'; %capitalizes the first letter Thanks for the help |