Azzera filtri
Azzera filtri

how to give range in xlsread using edit text field in app designer?

4 visualizzazioni (ultimi 30 giorni)
i was to read a coloumn from xlsx file which is simple to implement as following
columnB = xlsread(myExample.xlsx,'B:B'); % this works
but i m designing a app in appdesigner, i want to give option to user to input desired column name, i tryed this through
% lets suppose my text edit field is named as app.Columneditfield
columnB = xlsread(myExample.xlsx,'app.Columneditfield.Value:app.Columneditfield.Value');
% this gives error not a valid range
% because when '' is used to define range it does not pick >>app.Columneditfield.Value<<
% kindly guide

Risposta accettata

Rik
Rik il 7 Gen 2022
Assuming app.Columneditfield.Value is already a char, you can simply create the range like this:
Range=[app.Columneditfield.Value ':' app.Columneditfield.Value];
columnB = xlsread('myExample.xlsx',Range);
  11 Commenti
Rik
Rik il 12 Gen 2022
You forgot to leave in the spaces:
%You wrote:
Range = [app.ColumnEditField.Value':'app.ColumnEditField.Value];
%You should have written:
Range = [app.ColumnEditField.Value ':' app.ColumnEditField.Value];
taimour sadiq
taimour sadiq il 12 Gen 2022
i really made a silly mistake.. appreciate ur patience... Now it works fine according to my requirement.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by