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

4 visualizaciones (últimos 30 días)
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;

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by