how to give range in xlsread using edit text field in app designer?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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
採用された回答
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 件のコメント
Thanks i will update you soon after trying the guidelines.
after weekend i m again on code, i think i m making some mistake in defining app.Columneditfield.Value as a char
when i simple use the below code as u guided
Range=[app.Columneditfield.Value ':' app.Columneditfield.Value];
columnB = xlsread('myExample.xlsx',Range);
it gives error "a quoted character vector is unterminated" and highligh text after :
can u little eloborate further that how may i define app.Columneditfield.Value as a char
i also tried following
char = app.Columneditfield.Value
char(app.Columneditfield.Value)
coloumn = 'app.Columneditfield.Value'
Rik
2022 年 1 月 10 日
What class is app.Columneditfield.Value? I don't immediately see how this code can result in this error.
taimour sadiq
2022 年 1 月 10 日
編集済み: taimour sadiq
2022 年 1 月 10 日
Dear Rik i may not be able to properly answer your question that which class is app.Columneditfield.Value... one app.UIAxes i put an "EditField Text" icon and write xlread read code in callback... to simple the scenerio i can share a proper working file after few hours which inlcude the code in appdesigner also some screen shot to illustrate the issue.
You can put this line in your code to easily check:
uialert(app.UIFigure,sprintf('class name is %s',class(app.Columneditfield.Value)),'')
appreciate ur guidence, this line also giving a error in code before execution
uialert(app.UIFigure,sprintf('class name is %s',class(app.Columneditfield.Value)),'')
>> Invalid syntax at 'class'. A '(' might be missing a closing')'
Rik
2022 年 1 月 11 日
The actual error must be somewhere else, because this line of code is correct. Check the rest of the code for mismatched parentheses and other syntax errors.
yes ur assumption about error is possible, i will review the whole code and will update hopefully tommorow.

i have attached a demo app fie to illustrate... Kindly guide further... class name is char
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];
i really made a silly mistake.. appreciate ur patience... Now it works fine according to my requirement.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Develop Apps Using App Designer についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
