findobj for multiple 'Tag's
古いコメントを表示
Hi, is there any way I could look for multiple tags like this:
findobj(0,'Tag',['Name1','Name2','Name3',etc])
instead of
findobj(0,'Tag','Name1','-or','Tag','Name2','-or','Tag','Name3'...etc)
????
Thank you
採用された回答
その他の回答 (1 件)
per isakson
2013 年 6 月 17 日
編集済み: per isakson
2013 年 6 月 17 日
A shot in the dark with R2012a. This returns handles rather than an error message
>> findobj(0,'Tag',{'Name1','Name2','Name3'} )
ans =
0
221.0011
220.0011
219.0011
218.0011
188.0011
156.0011
190.0011
189.0011
158.0011
157.0011
>>
Cell array would be the Matlab way. Compare set. However, I don't think it is covered by the documentation.
No good:
>> h = findobj(0,'Tag',{'Name1','Name2','Name3'} );
>> get( h, 'Tag' )
ans =
''
''
''
''
''
''
''
''
''
''
''
2 件のコメント
Andrew Reibold
2013 年 6 月 17 日
編集済み: Andrew Reibold
2013 年 6 月 17 日
Nice! I think my answer was doing it the hard way.
Always better to use arrays/vectors than a loop whenever possible. It is much more resource efficient. Use this answer Victor
per isakson
2013 年 6 月 17 日
編集済み: per isakson
2013 年 6 月 17 日
I'll file this as a request or bug:-)
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!