openfig gives figure with no handle!
3 次查看(过去 30 天)
显示 更早的评论
The 2014B "ugrade" is a disaster! Openfig opens figure, but it has no handle...
IN 2015:
>> h=openfig('pv','new')
h =
Figure (fig) with properties:
Number: [] *<-- NOTE NO HANDLE!!*
Name: '_1'
Color: [0.9412 0.9412 0.9412]
Position: [58 39 507 459]
Units: 'pixels'
Show all properties
***************************
IN 2013B:
>> h=openfig('pv','new')
h =
173.0011
HELP! How can I use openfig and keep track of multiple open figures?
Thanks,
Bill
2 个评论
Charles Teasley
2016-4-20
编辑:Charles Teasley
2016-4-20
Hello Bill,
I am confused a little. What is 'pv'? The "openfigure()" class needs an existing figure name (i.e. "Figure.fig"). Once I execute your code with an existing figure name I get handles. Therefore, I need more info. I'm using 2015b.
Charles
Walter Roberson
2016-4-20
openfig() loads .fig file and returns its handle, so pv.fig was being loaded.
回答(2 个)
Walter Roberson
2016-4-20
HG2, R2014b and later, no longer use numeric handles. The h you are getting returned is the handle. As long as you use the content, you will be fine.
If you really need to, then use for the next few releases you can use double(h) to get a numeric value. You would generally need to use handle() to get back to the handle before it could be further used, but you can use it to assure yourself that you are referring to different figures.
You can also use
set(h, 'IntegerHandle', 'on')
It will then find an integer handle number not in use and will populate the Number property with that.
0 个评论
Azzi Abdelmalek
2016-4-20
h.number
1 个评论
Walter Roberson
2016-4-20
openfig did not usually return integer handles, and in R2014b and later, the Number property is empty if you do not have an integer figure handle.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!