I want to store user inputs in an array, but when a person enters a new number, the previous input gets replaced. How can I create such an array in Matlab such that I can store all inputs without replacement? I am a beginner so bear with me
Thanks
You simply need to copy the contents of the input buffer into a data struct that won't be overwritten.
Cell arrays are good for that (see the userInputs variable below) . Without better knowledge of your code, I'm guessing the user input is stored in a variable named buffer. Here's how I would do it:
% a new buffer comes in
userInputs{iInput} = buffer;
iInput = iInput + 1;
% keep looking for more inputs
Good luck!