Copy utiable to Excel

조회 수: 7 (최근 30일)
Jason
Jason 2011년 2월 23일
댓글: Ding Cloud 2020년 12월 18일
I have populated a uitable created in GUIDE with some data. I want to be able to click a button and have the uitable data copied to clipboard so I can then paste into Excel. So far I have the following code for a button callback:
s=get(handles.uitable1,'data');
clipboard('copy', s);
However, this just creates one large string in excel and not each uitable cell to an exel cell. any suggestions. Thanks Jason

답변 (1개)

Robert Cumming
Robert Cumming 2011년 2월 24일
you will see in the clipboard help that clipboard converts your matrix to a string using MAT2STR.
In the past I've had a similar issue and in that case I created the string myself with delimiter between each number (build it with sprintf and formatting).
  댓글 수: 7
Jay Basingerja
Jay Basingerja 2020년 4월 2일
Thank you Paolo and Robert, this worked for me as well.
Frustrating that it isn't already something addressed by Mathworks, because that was a key reason I was building my GUI in the first place, to provide data that could be copied out to Excel and pasted where the user wanted it, but this will serve as an acceptable workaround.
Ding Cloud
Ding Cloud 2020년 12월 18일
thanks, Paolo Minotti, your method is really useful.

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by