当前位置:文档之家› matlab图像输出设置

matlab图像输出设置

2.h = findobj:
返回根对象的句柄和所有子对象
3.h = findobj('PropertyName',PropertyValue,...)
返回所有属性名为‘PropertyName’,属性值为'PropertyValue'的图形对象的句柄。可以指定多个属性/值对。
4.h = findobj('PropertyName',PropertyValue,'-logicaloperator', PropertyName',PropertyValue,...)
$<name>引用名叫name的被捕获字符串
(?(name) s1 | s2)我想您应该知道是什么意思
nargin是用来判断输入变量个数的函数,这样就可以针对不同的情况执行不同的功能。通常可以用他来设定一些默认值,如下面的函数。
例子,函数test1的功能是输出a和b的和。如果只输入一个变量,则认为另一个变量为0,如果两个变量都没有输入,则默认两者均为0。
findobj
findobj:特殊属性的图形对象
语法:
1.findobj:
findobj返回根对象的句柄和所有子对象(findobj returns handles of the root object and all its descendants without assigning the result to a variable.)
பைடு நூலகம்例子:
在当前坐标下查找所有直线对象:
h = findobj(gca,'Type','line') %gca为当前坐标的句柄
查找Label属性设为'foo'和String设为'bar'的所有对象:
h = findobj('Label','foo','-and','String','bar');
查找String不为'foo'也不为'bar'的所有对象:
5.box off
6.axis([xL yL])
1.t=linspace(0,8,100);
%%%linspace(X1, X2) generates a row vector of 100 linearlyequally spaced points between X1 and X2.
linspace(X1, X2, N) generates N points between X1 and X2.
expr1|expr2匹配expr1或者expr2
非匹配操作符(常用于在正则表达式内添加注释)
(?# blabla) blabla是注释内容
占位符
^字符串起始
$字符串结尾
\<单词起始
\>单词结尾
环视
(?=expr)从当前位置向前看(字符串向右的方向),测试是否匹配expr
(?!expr)从当前位置向前看(字符串向右的方向),测试是否不匹配expr
3.plot(t,sin(t));
4.xt=get(gca,'xtick');
5.set(gca,'XTick',[],'XColor','w');
6.xL=xlim;
7.p=get(gca,'Position');
8.box off;
1.figure
2.a2=axes('Position',p+[0,p(4)/2,0,-p(4)/2]);%确定坐标位置,p为上述
% figure的position中的[left bottom width height]是指figure的可画图的部分的左下角的坐标以及宽度和高度。
(4)使用copy figure将图片输出到Word
1.figure;
2.hold on;
3.set(gca, 'YTick', [0 : 0.2 : 1]);
7.h = findobj(objhandles,...)
限制搜索范围为objhandles和他们的子图中
8.h = findobj(objhandles,'-depth',d,...)
指定搜索深度,深度参数'd'控制遍历层数,d为inf表示遍历所有层,d为0等同d='flat'
9.h = findobj(objhandles,'flat','PropertyName',PropertyValue,...)
h = findobj('-not','String','foo','-not','String','bar');
h = findobj('String','foo','-and','Tag','button one',...
'-and','-not',{'Color','red','-or','Color','blue'})
Find all objects for which you have assigned a value to the Tag property (that is, the value is not the empty string ''):
h = findobj('-regexp','Tag','[^'']')
'flat'限制搜索范围只能是当前层,不能搜索子图。
如果句柄指向一个不存在的图形,findobj返回一个错误。
findobj正确匹配任何合法属性值,例如:
findobj('Color','r')
找到所有color值为红的对象。
为了寻找满足指定条件的额handle对象,我们可以使用handle.findobj。
-logicaloperator可以取值:
-and
-or
-xor
-not

5.h = findobj('-regexp','PropertyName','regexp',...)
属性名可以使用正则表达式
6.h = findobj('-property','PropertyName')
如果存在‘PropertyName’这个属性名,就返回此图形句柄
核心方法:通过图像设置命令,直接指定图片的大小。
具体操作:
(1)完成画图及相关设置(字体大小、线宽、图例大小也是正常尺寸),
(2)此时WindowStyle is 'docked',要改为normal,有两种操作:
1)在Figure properties——more properties中找到
Windowstyle,然后用鼠标改为normal;
Find all children of the current figure that have their BackgroundColor property set to a certain shade of gray ([.7 .7 .7]). This statement also searches the current figure for the matching property value pair.
4.box off;
5.set(gca, 'YTickLabel', {'matlab1', 'matlab2', 'matlab3',...
6.'matlab4', 'matlab5', 'matlab6'})
1.hold on
2.xL=xlim;
3.yL=ylim;
4.plot(xL,[yL(2),yL(2)],'k',[xL(2),xL(2)],[yL(1),yL(2)],'k')
2)或者直接用命令:
set (gcf,'windowstyle','normal')
(3)根据排版要求,确定图片的宽高,例如320*320像素,然后使用命令
set (gcf,'Position',[500,300,320,320])
set(gcf,'Units','centimeters','Position',[100 10098]);
function y=test1(a,b)
if nargin==0
a=0;b=0;
elseif nargin==1
b=0;
end
y=a+b;
Matlab set函数
1.MATLAB给每种对象的每一个属性规定了一个名字,称为属性名,而属性名的取值成为属性值。例如,LineStyle是曲线对象的一个属性名,它的值决定着线型,取值可以是'-'、':'、'-.'、'--'或'none'。
expr+出现1次或更多次
捕获
(expr)捕获匹配得到的字符串
相关主题