フィルターのクリア

How to paste into multiple cells of a table in a GUI

10 ビュー (過去 30 日間)
Seyhan Emre Gorucu
Seyhan Emre Gorucu 2012 年 8 月 2 日
コメント済み: MT_jsmith 2021 年 8 月 4 日
Hello,
I have an editable table which is built on a programmatic gui. I can paste the values 1 by 1. However, I cannot paste my values all together. Is there a way to paste values from excel to the table without doing one by one?
Thank you,
Emre
  2 件のコメント
Gary Jahns
Gary Jahns 2015 年 11 月 3 日
Hmmm...No comments in over 3 years. Too bad, I would like to be able to do this too, but it sounds like you can't do it:-(
MT_jsmith
MT_jsmith 2021 年 8 月 4 日
Hmmm...i met the same problem:-(

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

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 11 月 3 日
No. You would instead use xlsread() or an ActiveX object to read the values from Excel. Then you would get() the Data property of the uitable, replace the subset of entries with the new contents, and set() the Data property to the result.
For example, in the case of a uitable that contains only numeric data:
nums = xlsread('MyFile.xls');
curdata = get(handles.uitable1, 'Data');
rowstart = 3; colstart = 7; %to start pasting at (3,7)
curdata(rowstart : rowstart + size(nums,1) - 1, colstart : colstart + size(nums,2) - 1) = nums; %new data goes in
set(handles.uitable1, 'Data' curdata);

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by