Effacer les filtres
Effacer les filtres

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

4 vues (au cours des 30 derniers jours)
taimour sadiq
taimour sadiq le 7 Jan 2022
Commenté : taimour sadiq le 12 Jan 2022
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

Réponse acceptée

Rik
Rik le 7 Jan 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 commentaires
Rik
Rik le 12 Jan 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 le 12 Jan 2022
i really made a silly mistake.. appreciate ur patience... Now it works fine according to my requirement.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by