matlab edit 换行,如何让MATLAB的edit编辑器自动换行

在MATLAB的edit编辑器中,通过设置edit控件的max属性为大于1的整数,并使用元胞数组,可以实现自动换行。例如在title中使用元胞数组来创建多行标题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

匿名用户

1级

2018-11-22 回答

MATLAB的edit如果要自动换行,其中修改edit控件的max属性必须是大于1的整数,max-min大于等于2就行了,具体操作如下:

例如:

a=1;b=2;c=3;d=4;

title(['abc','L Range:',num2str(a),'(nm)','~~',num2str(b),'(cm)','B Range:',num2str(c),'(cm)','~~',num2str(d),'(cm)']);

使用元胞数组便可以了。

a=1;b=2;c=3;d=4;

title({['abc','L Range:',num2str(a),'(nm)','~~',num2str(b),'(cm)'];['B Range:',num2str(c),'(cm)','~~',num2str(d),'(cm)']});

下面的程序是绘制岩石圈在地表和地下垂向载荷作用下进行挠曲的示意图。程序中便包含利用元胞数组使title中的字符换行的程序。

如title({'(b)'; 'equilibrium state'})

% % % %-------------------------------

x=-2*pi:0.01:2*pi;

y=sin(x+pi/6);

y1=0*x-3;

y2=0*x-6;

subplot(3,3,1)

plot(x,y,'k',x,y1,'k',x,y2,'k','linewidth',2)

ylim([-6.5 1])

text(x(end)+1,y(end),'surface')

text(x(end)+1,y1(end),'Moho')

text(x(end)+1,y2(end),'LAB')

text(x(1)-2,y(1),'H_I')

title({['(a)'];['initial surface loading']})

axis off

y=sin(x+pi/6)*3/5;

y1=-3-sin(x+pi/6)*2/5;

y2=-6-sin(x+pi/6)*2/5;

subplot(3,3,2)

plot(x,y,'k',x,y1,'k',x,y2,'k','linewidth',2)

hold on

y1=0*x-3;

y2=0*x-6;

plot(x,y1,'k--',x,y2,'k--','linewidth',2)

text(x(end)+1,y(end),'surface')

text(x(end)+1,y1(end),'Moho')

text(x(end)+1,y2(end),'LAB')

text(x(1)-3,y(1),'H_T')

text(x(1)-3,y1(1),'W_T')

text(x(1)-3,y2(1),'W_T')

title({'(b)'; 'equilibrium state'})

ylim([-6.5 1])

axis off

y=0*x;

y1=-3+sin(x-pi/4);

y2=0*x-6;

subplot(3,3,7)

plot(x,y,'k',x,y1,'k',x,y2,'k','linewidth',2)

ylim([-6.5 1])

text(x(end)+1,y(end),'surface')

text(x(end)+1,y1(end),'Moho')

text(x(end)+1,y2(end),'LAB')

text(x(1)-3,y1(1),'W_I')

title({'(c)';'initial Moho loading'})

axis off

y=-sin(x-pi/4)*1/5;

y1=-3+sin(x-pi/4)*4/5;

y2=-6-sin(x-pi/4)*1/5;

subplot(3,3,8)

plot(x,y,'k',x,y1,'k',x,y2,'k','linewidth',2)

hold on

y=0*x;

y2=0*x-6;

plot(x,y,'k--',x,y2,'k--','linewidth',2)

text(x(end)+1,y(end),'surface')

text(x(end)+1,y1(end),'Moho')

text(x(end)+1,y2(end),'LAB')

text(x(1)-3,y(1),'H_B')

text(x(1)-3,y1(1),'W_B')

text(x(1)-3,y2(1),'H_B')

title({'(d)';'equilibrium state'})

ylim([-6.5 1])

axis off

y=sin(x+pi/6)*3/5-sin(x-pi/4)*1/5;

y1=-3-sin(x+pi/6)*2/5+sin(x-pi/4)*4/5;

y2=-6-sin(x-pi/4)*1/5-sin(x+pi/6)*2/5;

subplot(3,3,6)

plot(x,y,'k',x,y1,'k',x,y2,'k','linewidth',2)

hold on

y2=0*x-6;

plot(x,y2,'k--','linewidth',2)

ylim([-6.5 1])

text(x(end)+1,y(end),'surface')

text(x(end)+1,y1(end),'Moho')

text(x(end)+1,y2(end),'LAB')

text(x(1)-3,y(1),'H')

text(x(1)-3,y1(1),'W')

text(x(1)-6,y2(1),'W_T+H_B')

title({'(e)';'integrated equilibrium state'})

axis off

% % % %-------------------------------

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值