Fill editfield text value with string from a table

조회 수: 4 (최근 30일)
Massimo
Massimo 2023년 6월 8일
편집: Les Beckham 2023년 6월 12일
What I need to do is to read data from a csv like the one I have updated and then fill an edit field in app designer with what is written in that csv file.
As example i updated one with just a simple text in it.
I have tried with something like
DataComments = readtable('file7.csv');
app.CommentsEditField.value = DataComments
but it doesn't work.

답변 (1개)

Les Beckham
Les Beckham 2023년 6월 8일
For this specific example, readlines might work better than readtable.
DataComments = readlines('file7.csv')
DataComments = 3×1 string array
"Comments" "testo di prova" ""
Then pick which one of these three strings you want to use to fill in your EditField. For example:
app.CommentsEditField.value = DataComments(2);
disp(app.CommentsEditField.value)
testo di prova
  댓글 수: 4
Massimo
Massimo 2023년 6월 12일
Ok, thank you. I have tried to make it work with a drop down menu, but it doesn't work. It goes in conflict with item data of drop down menu.
Les Beckham
Les Beckham 2023년 6월 12일
If you want help with that issue, you are going to need to provide your app designer code and any data needed to run it (or a stripped down version of it that illustrates the issue).

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by