How to display a cell content in MATLAB appdesigner
Afficher commentaires plus anciens
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 ?
Réponses (1)
Akanksha
le 1 Mar 2025
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 commentaire
Walter Roberson
le 1 Mar 2025
app.EditField.Value = strjoin(string(app.t{:,1}));
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!