How to write xls comment nodes (red corners) from Matlab ?
이전 댓글 표시
I use the standard xlswrite function to write data into xls from Matlab :
xlswrite(name_xls,xls_data,1,'A1');
I would like to write comments (the pop-up that comes when hovering over the cells) simultaneously :
xlswritewithcomments(name_xls,xls_data,xls_comments,1,'A1');
Anybody knows if there is a function I did not find or some way to do this ?
Working with ActiveX is really not the most interesting part of Matlab, so if someone has a working code or pieces of code, I am interested.
Anyway, here is one of my attempts for comments :
xls macro :
Range("A1").Select
Range("A1").AddComment
Range("A1").Comment.Visible = False
Range("A1").Comment.Text Text:="Arnaud LASTNAME:" & Chr(10) & "qsd"
Matlab :
>> Select(Range(Excel,'A1'));
>> Excel.selection.AddComment;
>> set(Excel.selection.Comment,'Visible',false);
>> set(Excel.selection.Comment,'Text','My comment');
Error using Interface.00024427_0000_0000_C000_000000000046/set
Error: method or property not found
And Text IS defined :
>> Excel.selection.Comment.Text
ans =
Thanks Arnaud LASTNAME:
채택된 답변
추가 답변 (1개)
Iain
2014년 8월 27일
0 개 추천
There is a solution. Its called "write your own function".
Step 1: If you open up the code for xlswrite, you'll be able to see how matlab interacts with excel.
Step 2: Open excel and record a macro of you putting a comment into a cell.
Step 3: Read that macro's code.
Step 4: Adapt the code behind "xlswrite" to do what you need it to. - You'll likely need to use a fair amount of trial and error to get it right. "Excel.Show" might be of use :P
댓글 수: 2
Iain
2014년 8월 27일
set(Excel.selection.Comment,'Visible',false);
set(Excel.selection.Comment,'Text','My comment');
Just a guess, but
Excel.selection.Comment.Visible = 1; % or
Excel.selection.Comment.Show
Might work...
카테고리
도움말 센터 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!