フィルターのクリア

Is there an analagous command to VB's 'with'?

4 ビュー (過去 30 日間)
Jeff
Jeff 2011 年 2 月 13 日
In VB, use can use 'with' to executes a series of statements on a single object. Example: With textbox1 .Height = 100 .Width = 500 End With
My code: freq(col).idx=freq(col).idx+1; freq(col).xtrmum(freq(col).idx,1).start=M(ii-2,col); freq(col).xtrmum(freq(col).idx,1).second=M(ii-1,col); freq(col).xtrmum(freq(col).idx,1).xtrm=M(ii,col); freq(col).xtrmum(freq(col).idx,1).fourth=M(ii+1,col); freq(col).xtrmum(freq(col).idx,1).end=M(ii+2,col); freq(col).xtrmum(freq(col).idx,1).tstep=ii; ... freq(col).xtrmum(freq(col).idx,1).poly=polyfit(x,y,2); freq(col).xtrmum(freq(col).idx,1).polyD3=polyfit(x,y,3); freq(col).xtrmum(freq(col).idx,1).polyD4=polyfit(x,y,4);| ...
My code if I could use 'with': freq(col).idx=freq(col).idx+1; with freq(col).xtrmum(freq(col).idx,1) .start=M(ii-2,col); .second=M(ii-1,col); .xtrm=M(ii,col); .fourth=M(ii+1,col); .end=M(ii+2,col); .tstep=ii; ... .poly=polyfit(x,y,2); .polyD3=polyfit(x,y,3); .polyD4=polyfit(x,y,4); ... end with
I can't find a 'with' or anything in Matlab help. Is there one? Thanks, Jeff

回答 (2 件)

Paulo Silva
Paulo Silva 2011 年 2 月 13 日
You can use the set function to change object properties
a=figure; %create a figure
set(a,'name','Myfigure','color',[1 0 0]) %change the name and color

Walter Roberson
Walter Roberson 2011 年 2 月 14 日
No there is not. However, if the object referenced is a handle object, then setting a variable equal to the prefix object (handle) and then using that variable should work. I am not certain that the same thing will work for non-handle object: I think it would depend upon the details of the object.

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by