Print Command
7 次查看(过去 30 天)
显示 更早的评论
Hello
Can anybody tell me that how to use the print command in matlab?
As i want to get the data from the textbox and print that particular data. not the whole figure.
Please anybody help..
2 个评论
Walter Roberson
2012-5-15
"print" is for creating the kinds of outputs that might be sent to a printer. Is that what you want? Or are you looking to create a text file?
回答(1 个)
Walter Roberson
2012-5-15
Let h be the handle of the uicontrol of style Text. Then
h_handle = handle(h);
h_image = h_handle.getPrintImage;
At this point, h_image will be an RGB array containing a rendered copy of the text. You can now figure() a new figure, image() h_image into the new figure, and print() the new figure.
You might wish to consider, however, using imwrite() on h_image to save it to an image file that you can print using your system utilities.
I have my doubts that any of this is what you really want to do, but...
18 个评论
Walter Roberson
2012-5-25
Yes, I do have R2010b at work, and yes it does have getPrintImage
>> h = uicontrol('style','edit','String','hello there')
h =
0.0009765625
>> hh = handle(h)
hh =
uicontrol
>> methods(hh)
Methods for class hg.uicontrol:
getGUIDEView getPrintImage
>> hh.getPrintImage
ans(:,:,1) = [...]
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!