write data to uitable
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
the question is : in pushbutton callback i read this code:
C=[h1 h2 h3 h4 h5 h6];
set(handles.uitable1,'DATA',C);
the uitable1 display the result in the first row,
while i will change the value of C, when i push the pushbutton again, how to write C to sceond row?
採用された回答
Walter Roberson
2017 年 12 月 11 日
current_data = get(handles.uitable1, 'data');
newdata = [current_data; C];
set(handles.uitable1, 'data', newdata);
12 件のコメント
ww ww
2017 年 12 月 11 日
thank you ,I read this code ,but when i push the pusbutton ,the uitable show two row .

ww ww
2017 年 12 月 11 日
i want when i fist push the button ,the uitable show the first row,when i second push,the uitable show the data in second row ,and so on ,the first row save the date which not changed.
Jan
2017 年 12 月 11 日
@ww ww: I do not really understand, what you are asking for. What should appear in the first and second row at the third click?
ww ww
2017 年 12 月 11 日
such as,I have an edit1 ,an uitable1 and a pushbutton1,I write data to edit1,after some caculations,I get the data C and show in frist row of uitable, now,I will write different data to edit1,then I get the different data C,so,I want to show the different data C in sceond row of uitable1,if I change data C again,it will be show in third row.
ww ww
2017 年 12 月 11 日
@Jan Simon: thank you very much,how can i do this?
Jan
2017 年 12 月 11 日
@ww ww: But this is exactly what Walter's suggestion does.
By the way, I asked: "What should appear in the first and second row at the third click?" As far as I understand, the answer is: "The values create by the first and second click".
@Jan Simon but,it can not work,i took Walter Roberson advice,i mean,when i frist click,uitable show like this

this is my code
C=[h12 q3 pwf2 cy2 glr2 qd]; %one row
set(handles.uitable3,'DATA',C);
current_data = get(handles.uitable3, 'data');
newdata = [current_data; C];
set(handles.uitable3, 'data', newdata);
i mean,i have only one pushbutton,when i frist click,uitable show the first row,when i second click ,the data show in second row ,but,now when i second click, the data covered the first row.
Walter Roberson
2017 年 12 月 11 日
Remove the
set(handles.uitable3,'DATA',C);
ww ww
2017 年 12 月 11 日
@Walher Roberson think you very much ,that is ok!
ww ww
2017 年 12 月 12 日
@Walter Roberson: sorry,I try agian this code ,it is can not work again,if i remove:
set(handles.uitable3,'DATA',C); % code
how can i get data from uitable? this is error

ww ww
2017 年 12 月 12 日
add an pushbutton~that is ok
Walter Roberson
2017 年 12 月 12 日
For this to work the first time, the data property has to have been left initialized to its default [] .
For it to continue to work, the number of columns in C needs to be the same as the number of columns in the existing table.
I suspect some of your calculated h values might be empty, giving you a C shorter than previous rows. Use the debugger to find out.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
タグ
参考
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)