Matlab setting & snippet
代码片段snippets
- 保存pdf调整a4纸至合适大小
h = figure;
plot(1:10);
set(h,'Units','Inches');
pos = get(h,'Position');
set(h,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
print(h,'filename','-dpdf','-r0')
- 缺省参数默认值设定
function f(arg1, arg2, arg3)
if ~exist('arg2', 'var')
arg2 = arg2Default;
end
hg1 = legend('第一条');
set(hg1,'FontSize',12,'Location', 'SouthOutside','box','off');
%注:将legend放在图外面时,Legend 1不能通过鼠标移动,只能通过代码调整位置
% ============= Legend 2 :
ah2 = axes('position',get(gca,'position'),'visible','off');
hg2 = legend(ah2, [p2 p3], '第二条', '第三条');
set(hg2,'FontSize',12,'Location', 'SouthOutside',...
'Orientation','horizontal','box','off');
Another way:
legend({'cos(x)','cos(2x)','cos(3x)','cos(4x)'},'Location','northwest','NumColumns',2)
- mac打开时闪退
/Applications/Polyspace/R2019b.app/bin/matlab -nosplash
- matlab-mex命令 10.15.4问题
https://www.mathworks.com/matlabcentral/answers/512901-mex-xcodebuild-error-sdk-macosx10-15-4-cannot-be-located/?s_tid=mlc_lp_leaf
绘制等高线
contour(u, v, z, [-0.5, -0.5], 'LineWidth', 2)
区间是zlim
欢迎关注微信公众号“探物及理”
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从二进制到误差:逐行拆解C语言浮点运算中的4008175468544之谜
· .NET制作智能桌面机器人:结合BotSharp智能体框架开发语音交互
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· Windows桌面应用自动更新解决方案SharpUpdater5发布
· 我的家庭实验室服务器集群硬件清单
· C# 13 中的新增功能实操
· Supergateway:MCP服务器的远程调试与集成工具
· Vue3封装支持Base64导出的电子签名组件