Re: [討論] subplot 取 errorbar 的data

看板MATLAB作者 (郝渴連)時間12年前 (2012/03/21 09:09), 編輯推噓1(104)
留言5則, 2人參與, 最新討論串2/2 (看更多)
※ 引述《laion (回地球啦)》之銘言: : 我剛測試過假如只有一張圖 : h=figure : errorbar(x,y,err,'bo-') : 取誤差的data的寫法可用一般取data的方法 : 即 : get_err=get(get(gca,'children'),'UData') : 或把UData 改成LData也行 : ****** : 但同樣的方法在subplot下面卻不行 : 例如原圖為 : h1=subplot(1,2,1); : errorbar(x,y,err,'bo-'); : h2=subplot(1,2,2); : errorbar(x,y,err,'bo-'); : 假如我要取第一張圖的誤差 : s=get(gca,'children'); 不建議這樣做, 你怎麼知道gca是指第一張還是第二張圖, 而且這樣做是脫褲子放屁, h1即為第一張圖的axes handle,h2是第二張圖的, s = get(h1, 'children'); : get_err=get(get(s(1),'children'),'Udata') : 確沒有辦法得到數據 (似乎children下沒有udata的物件,用xdata/ydata都可以取到數據) : 有人知道原因嗎?? : 謝謝!! 因為你的s即為errorbar的handle, get(s,'children')是所有點以及誤差線(工)的handle, 所以可以讀取xdata/ydata但不能讀取udata -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 111.67.49.24

03/21 09:26, , 1F
喔 我知道那是多此一舉啦 ~~ 我只是舉個例子,今天下午在試
03/21 09:26, 1F

03/21 09:26, , 2F
有沒有辦法從*.fig檔取資料,但沒有成功
03/21 09:26, 2F

03/21 09:27, , 3F
請問你知道要怎麼取udata嗎?
03/21 09:27, 3F

03/21 15:08, , 4F
....
03/21 15:08, 4F

03/21 15:08, , 5F
get(s,'udata')啊!
03/21 15:08, 5F
文章代碼(AID): #1FQIfTPJ (MATLAB)
文章代碼(AID): #1FQIfTPJ (MATLAB)