Download file from MatLab
Show older comments
I'm currently working in MatLab AppDesigner. I am trying to get MatLab to download the contents of an editable Text Area as a specific type of file (.cfile) and save this file to a specific location. The user should be able to edit the code of the file in the Text Area, and then click a button which will cue MatLab to download the file as a .cfile and save it to a specific location on the user's device. Initially, the Text Area will contain a default code setup, which the user can modify before downloading. I am relatively new to MatLab; does anyone know how I could do this? Thanks!
10 Comments
Rik
on 2 Aug 2018
Download means it is loaded from a web page of some sort, but the rest of your description sounds like it's just saving a file.
Hanna Al-Kowsi
on 2 Aug 2018
Rik
on 2 Aug 2018
Then I would create a figure with a text field and a save button. The callback function for that uicontrol button would then use get to load the contents of the text field to a cell array. You can use uiputfile to ask te user for a file location. Then the writing of the file depends on your file format.
Hanna Al-Kowsi
on 2 Aug 2018
Hanna Al-Kowsi
on 2 Aug 2018
Rik
on 2 Aug 2018
I mentioned several functions. Did you read the corresponding documentation pages?
Hanna Al-Kowsi
on 3 Aug 2018
Edited: Hanna Al-Kowsi
on 3 Aug 2018
Rik
on 3 Aug 2018
The uiputfile function asks the user for a location to save your file to, it doesn't write the file. With the writing of the file we can't help you because you didn't give a description of the file format.
Hanna Al-Kowsi
on 3 Aug 2018
Rik
on 3 Aug 2018
If it is just a text file with some extension, you should be able to find plenty of examples how to write the contents of a cell to a text file. I could find what type of file it would be, as there isn't even a filext page.
Accepted Answer
More Answers (0)
Categories
Find more on Downloads 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!