- Drag and drop the buttons and an axes onto the app
- Define a property, e.g. app.dataTable, where the table of data that is to be read in is stored for use by callbacks
- Define ButtonPushed callback functions for the upload and plot buttons.
- The callback function for the upload uses uigetfile to let the user browse for the file, and reads the data into app.dataTable
- The callback function for the plot function uses the data stored in the app.dataTable property and plots it to the axes e.g. app.UIAxes, that is inside of your app. So use plot(app.UIAxes,x,y...) rather than plot(x,y). Otherwise a new figure window will open up outside of your app, and I don't think this is what you want.
How to upload a CSV file using a button on App Designer and using its content in another function.
20 ビュー (過去 30 日間)
I want to create an upload button and a plot button. The upload button will open a file browser and the user should be able choose the desired csv file. I want to read this csv as a table. Next using the plot button, I want to plot the values form that csv and analyze it further more.
Jon 2022 年 6 月 28 日
編集済み: Jon 2022 年 6 月 28 日
I have attached a very rough example to get you started along with a data file to try it with.
Here are the main ideas (using App Designer):
The attached example is very basic, you would have to format things nicely, label your plot, make sure the user can't plot without first selecting a file etc.