Date: Mar 20, 2014 3:50 PM
Author: Stephen
Subject: saving strings in a for loop

I'm working on a problem in which I have written a script to extract the first letter of each word in a sentence.  These collected letters form a new word.  I have ten sentences  (and therefore ten words that I need to save to make a new sentence).  I put a for loop around the extraction script, but I can't figure out how to save the word decoded from each sentence.  my variable 'word' is simply overwritten every time I go through the loop.

%a-j are the individual sentences
% What I've done is write the sentences, and concatenate them into a matrix. I look for spaces in each row (sentence) and concatenate the first letter and every letter following a space to form 'word.'

I want to save each word in an array and print it out so it reads like a sentence.

z=char (a,b,c,d,e,f,g,h,i,j)

for n=1:r;
s=find(x==' ');
word = [x(1), x(s+1)]