Append to an array
Show older comments
Hi all,
I have a function called details, where the user enters his name, and the details are stored in the array, say "name". Each time a name is entered it should get appended to the array.
At any point, the user can cancel entering the details and do other computations. Then again the user can start entering the details. In this case, it should get appended to the "name" array that is already existing.
At the beginning of the session, the array "name" should be empty.
1 Comment
Azzi Abdelmalek
on 18 Sep 2013
post your code
Accepted Answer
More Answers (1)
Vinaya Babu Yerneni
on 16 Oct 2020
0 votes
Firstly you need to clarify whether you need to append strings or integer or string and integer
for only strings
name=input('What is your name? ', 's');
age=input('What is your age? ',"s");
hometown=input('What is your hometown? ', 's');
sport=input('What is your favorite sport? ', 's');
Temptex2=append(name,age,hometown,sport)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!