Matlab Appdesigner Saving Data to Text File

7 views (last 30 days)
I on 23 Apr 2021
Answered: I on 28 Apr 2021
% Button pushed function: SaveButton
function SaveButtonPushed(app, event)
app.t.Thrust(1) = str2num(app.SaveButton);
fileid = fopen ('C:\**\**\**\**\***\**\****.txt')
Error using str2num (line 35)
Input must be a character vector or string scalar.
The above is the code giving me the problem.
I am just trying to save one number from my data to a text file and I got the above error.
Is there an alternate command to proceed with this step?
Rik on 28 Apr 2021
Is app.UITable.Data a numeric data type that is supported by str2double?

Sign in to comment.

Accepted Answer

I on 28 Apr 2021
It seems I figured out the issue just based on your question alone.
I tried to just save the data straight to the text file and got an error returned
D = (app.UITable.Data(:,:)); % Assigning a variable to the table
Error using fprintf
Unable to convert 'table' value to 'double'.
Thist prompted me to "assume" that using an additional function was necessary. It's not. I don't completely know how to interact with app.UITable.Data, but I can extract the data entries. One of those entries is Thrust.
D = (app.t.Thrust(:,:));
The above resulted in:
Problem solved.

More Answers (0)




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by