How can I edit cells with string values in a UITABLE?
1 回表示 (過去 30 日間)
古いコメントを表示
I am trying to be able to edit a uitable, by means of using CellEditCallBack. However, even though I pretty much got the hang of it, I am finding trouble editing a cell containing a string, i.e., i want to input a value on the table that is actually not a number, but a string.
Is this possible? If so, how exactly does one get the CellEditCallBack only to work once the cell has been fully edited?
Also, why is it when I use get(hObject,'data') the result i get is NaN for the said string cell I am trying to edit?
0 件のコメント
回答 (1 件)
Andrew Newell
2011 年 1 月 26 日
The NaN may occur because the format for that column is numeric. That could be because you entered a numeric value for the property Data. You should enter a character value when you set up the table, e.g., for a 1-column table,
hObject = uitable('Data',{'whatever'});
If you later enter a numeric value, it will be converted to a string. If you don't want to specify an initial string, you could assign the column an empty string ('').
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!