How to display a cell content in MATLAB appdesigner

2 ビュー (過去 30 日間)
Elie Gédéon BIKIE
Elie Gédéon BIKIE 2022 年 3 月 7 日
コメント済み: Walter Roberson 2025 年 3 月 1 日
Hi everyone, I'm new on MATLAB and I'm having a issue on displaying a cell content in a Edit Field text box with the fonction/command celldisp in MATLAB appdesigner. I'm getting this error : Error using celldisp Too many output arguments.
Here is my code :
app.t = readtable("processus_dintegration.xlsx","VariableNamingRule","preserve");
app.NomsEditField.Value = celldisp(app.t{:,1});
Can anyone give a other fonction that can help me ?

回答 (1 件)

Akanksha
Akanksha 2025 年 3 月 1 日
The error occurs because the function used i.e.celldisp” is meant for printing while here, it’s being used to assign output to an Edit Field.
I propose converting the cell array data into a single string that can be assigned t the Edit Field’s value property. Two common approaches are :
  • Using strjoin: This function takes a cell array of strings and concatenates them into one string using a specified delimiter (for example, a comma and space, or even a newline).
  • Using “sprint”: This function formats data into a string, and it is very handy if you want each cell element to appear on a new line.
For example :
  • If you want comma-separated list :
app.EditField.Value = strjoin(data.Fruit,, );
  • If you want each element on its own line:
app.EditField.Value = sprintf(%s\n’,data.Fruit{:});
Below are some documentation links that will help you further :
Hope this helps. Thanks.
  1 件のコメント
Walter Roberson
Walter Roberson 2025 年 3 月 1 日
app.EditField.Value = strjoin(string(app.t{:,1}));

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by