testweb3.m

来自「MATLAB扩展编程by 孙永康.ZIP.有需要的朋友请来下载.」· M 代码 · 共 32 行

M
32
字号
function retstr = testweb3(in)

% 初始化返回字符串
retstr = char('');

% 设置工作目录,保存图片用
cd(in.mldir);

% 读取html文件中表单数据
x = str2double(in.x);
y = str2double(in.y);

z = x * sin((y+[1:256])*2*pi/256);
f = figure('visible','off');
plot(z)
% Adjust size
pos = get(gcf, 'position');
pos(3) = 380;
pos(4) = 310;
set(gcf, 'Position', pos, 'PaperPosition', [.25 .25 4 3]);
drawnow;
pic = sprintf('%spic.jpeg', in.mlid);
wsprintjpeg(f, pic);
close(f);

% 设置输出变量,共输出html文件用
out.pic = pic;

% 调用HTMLREP,生成html输出文件
tmpfile = which('testtmp3.html');
retstr = htmlrep(out, tmpfile);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?