Hi Seth,
If I understand your question correctly, your requirement is to input data from a text file in "AppDesigner", perform operations on the data, plot the data, store the data in an array, and finally write the array to a text file.
I hope the procedure below helps you solve the issue you are facing.
- Create the required variables in the properties section with public access.
- Create a function (can be a callback function that triggers when a button is clicked) that initializes your variables “A”, and “store” and performs the required operations and finally writes the data into an output file.
- Instead of explicitly mentioning hold on in the “AppDesigner”, it is suggested to pass the component name as an argument, since there can be many arguments present i.e., hold(app.UIAxes, "on")
- New entries can be added to the “store” array using concatenation rather than using index assignment, since there is no pre-allocation of memory to the “store” array.
Initializing “A” can be done using the "readmatrix" function. With this, the complete data that is present in the text file is stored as an array in “A” and the entries in it can be accessed using indexing. Instead of reading one line of text file at a time, whole data in the file is read into a single array. Similarly, for writing the output into a file, "writematrix" function can be used. Initialize “store” as an empty array.
Below mentioned are a few links that can help you understand more about reading and writing a matrix, using the hold function.
- Reading a matrix from a file: - https://www.mathworks.com/help/matlab/ref/readmatrix.html
- Writing a matrix to a file: - https://www.mathworks.com/help/matlab/ref/writematrix.html
- Hold: - https://www.mathworks.com/help/matlab/ref/hold.html
Hope this helps.