Is it possible to have a set of data under a while loop and add them to a vector of matrices and then refer back to that same vector? For example, the user enters a set of data into a program whilst its under a while loop with an if statement and the program then refers back to that same data under a different if statement? The program below allows to list people but is it possible to add the people listed to a character vector and refer back to it when you have count them or pick one of them out. I could add 3 people of different ages and names and then count how many of them are added.
while prompt >=' ' prompt=input('\nWhat would you like to do: ', 's');if strcmp(prompt,'list people') name=input('Name: ', 's'); gender=input('Gender: ', 's'); age=input('Age: ', 's');elseif strcmp(prompt, 'count people') endend
Best Answer