Filter löschen
Filter löschen

How can i call exact cell value from excel to edit field value in Matlab App

5 Ansichten (letzte 30 Tage)
I am trying to import and excel file which has inputs in some cells and then trying to assign it to Editfiled in matlab app so i can do simple calculation.
All i want it to do is take the value from a particular Excel cell and then assign it to this.
% Button pushed function: Button
function ButtonPushed(app, event)
[file,filepath] =uigetfile({'*.xlsx*'},'Select the Excel file');
filename =fullfile(filepath,file);
t= readcell(filename,'Sheet','Input','Range','A2:B34');
app.MassEditField.Value = t(2,"Var2");
app.ForceEditField.Value =t(13,"Var2");
app.m = app.MassEditField.Value;
app.g= app.ForceEditField.Value;
app.Result = app.m * app.g;

Akzeptierte Antwort

Voss
Voss am 2 Mai 2023
Use curly braces {} to get content from the table t:
app.MassEditField.Value = t{2,"Var2"};
app.ForceEditField.Value =t{13,"Var2"};

Weitere Antworten (0)

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by