Load data into GUI editable fields from txt

1 次查看(过去 30 天)
Pelajar UM
Pelajar UM2021-9-10
评论: Walter Roberson ,2021-9-10
I have an application with several inputs.
Currently, I input the data manually in the GUI. I want to add a push button and load a txt file that contains numbers, text, etc that goes into these fields.
Examples of the fields and the data:
app.REditField.Value = PEI
app.DEditField.Value = 1.33
app.Slider.Value = 20
% pick one
app.EButton = 0
app.SButton = 0
app.HButton = 1
I saw some examples with "eval" and "readtable" but they are not variables... Here’s what I have so far (I know it’s not much):
% Button pushed function: LoadDataButton
function LoadDataButtonPushed(app, event)
[filename] = uigetfile ({'*txt'});
  9 个评论
Walter Roberson
Walter Roberson 2021-9-10
If the extension is already .m or .p then
function LoadDataButtonPushed(app, event)
[filename, folder] = uigetfile({'*.m', '*.p'});
if ~ischar(filename); return; end %user cancel
filename = fullfile(folder, filename);


回答(0 个)


Community Treasure Hunt

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

Start Hunting!

Translated by