필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
taimour sadiq
taimour sadiq 2022년 1월 7일
댓글: taimour sadiq 2022년 1월 12일
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

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by