English 中文(简体)
鉴于一个分局的操作,如何获得其所有相关的彩bar?
原标题:Given a handle of a subplot, how to obtain all its associated colorbar handles?

例如:

Hsp=subplot(1,2,1);

image(rand(5,5));

Hc=colorbar;

subplot(1,2,2);

image(rand(5,6));

colorbar;

我的问题是,如何获得<代码>Hc,只给出<代码>Hsp。

众所周知,彩票的类型为axes。 因此,我试图搜查该分区的所有子女。

Hs=findall(Hsp, type , axes );

但<代码>没有价值。 Hs, 对应 Hc

最佳回答

你的彩票是数字中的儿童,不是你们的分野轴(col本身就是轴)。 提 出

hc = get(hf,  children )

to get a list of all children of the figure, where hf is the figure handle. I m not sure how you would which element of hc is equal to your Hc, i.e. which is the first colorbar.

http://www.ohchr.org。

www.un.org/Depts/DGACM/index_spanish.htm 如果你需要以后处理物体,最好将其分配到生成时的变量中,并在全程使用这一变量。

然而,如果你不想这样做(尽管我强烈建议你这样做),我可以认为你可以做两件事。 他们不是特别大的,而且无疑是更多的工作,只是把你的物体分配给一个变量。

如果你知道这些轴心的设立次序,那么你就坐在uck子上:如果是孩子,名单上的第一个孩子是last<>em>的,而最后一位孩子是first<>>。 例如,

hf = figure;

ha1 = subplot(1,2,1);
image(rand(5,5));
hc1 = colorbar;

ha2 = subplot(1,2,2);
image(rand(5,5));
hc2 = colorbar;

hcs = get(hf,  children )

hcs =

  206.0016
  204.0011
  176.0016
  174.0011

[hc2, ha2, hc1, ha1] 

ans =

  206.0016
  204.0011
  176.0016
  174.0011

Since you want the first colorbar, which was the second child created, you can then use

hc(end-2)

或者,在创造你今后想要提到的彩色时,将它设定为tag/code> 财产。 在上述例子中,取而代之

hc1 = colorbar;

iii

hc1 = colorbar( tag ,  myID );

You can then get the handle to this object later iii

findobj(hf,  type ,  axes ,  tag ,  myID )
问题回答

采用以下文字可以找到所有属于轴心的儿童的彩色屏障。 这里的Ha1是指有图像的轴心(例如分机)的操作,Hc1s为轴心的同 color。

function Hc1s = find_peer_colorbars_of_an_axes(Ha1)
    Hf = get(Ha1, parent );
    Haxs = findobj(Hf, type , axes );
    IsC=false(1,length(Haxs));
    Hc1s=[];

    for i=1:length(Haxs)
        if isa(handle(Haxs(i)), scribe.colorbar );
            H=handle(Haxs(i));
            if isequal(double(H.axes),Ha1)
                Hc1s=[Hc1s,Haxs(i)];
            end
        end
    end




相关问题
Handle a JNI crash

I have a dll that contains legacy C code, I call this dll via JNI, but sometimes the C code crashes and causes the JVM to terminate. Is it there a way to avoid JVM crash? Can I handle the JNI fault ...

Error in creating windows handle

I have created a .net 2.0 windows application. This application creates form controls dynamically. Now when I am trying to run the application, it is throwing an exception "Error in creating windows ...

Force create handle for Control

I m currently creating a silent print module. The current control I m using is, it s making sure that the control handle is already created (IsHandleCreated). I did everything to cheat this with no ...

Out of memory on _beginthreadex

I currently debug a multi threaded application, which runs without errors until some functions where called about 2000 times. After that the application stops responding, which I could track down to ...

Track handle creation / deletion

I have a large old program which has some rather complex graphical displays (all via standard API calls). The program appears to be working fine, but I recently looked at the "handles" field of ...

boost::thread causing small event handle leak?

I m debugging this database project. It wraps access to SQLite for a higher level application. It s designed to run asynchronously, that is, it has methods like ExecuteRequestAsync() and ...

Get handle of a window that has no title.. (C#)

How can we get the handle of a window that doesn t have a title? Is there a way to enumerate all the windows on desktop and filter the window that don t have a title (in my case, there is only one) ...