通过 `publish` 发布包含图像文件相对路径的报告
Publishing a report including a relative path to an image file via `publish`
我已阅读、测试 this documentation and this example 并自行尝试,但尚未找到所描述问题的解决方案。
根据文档,要么图像文件与使用的 MATLAB 脚本位于同一路径,在这种情况下,可以按照描述轻松添加它
% <<Filename.png>>
或者需要添加完整路径:
% <<C:\Fullpath\Filename.png>>
否则会得到一个空文档(至少在 publish
正在创建 .html 文件时)。
由于应共享记录的代码,我需要一个相对路径以避免以后出现问题。
MATLAB 中是否有任何解决方案或变通方法?
我之前的一些尝试:
% <<.\Filename.png>> # with and without "" or ''
% <<..\Filename.png>> # with and without "" or ''
% <<..\..\Filename.png>> # with and without "" or ''
图片没有出现。
假设这个目录结构:
这段代码,
function q51539865
%% Image From URL
%
% <<https://i.stack.imgur.com/zSPip.jpg>>
%
%% Image From Relative Path
%
% <<../InnerPath/zSPip.jpg>>
%
生成以下网页:
检查第 2nd 个图像时,我们看到:
我已阅读、测试 this documentation and this example 并自行尝试,但尚未找到所描述问题的解决方案。
根据文档,要么图像文件与使用的 MATLAB 脚本位于同一路径,在这种情况下,可以按照描述轻松添加它
% <<Filename.png>>
或者需要添加完整路径:
% <<C:\Fullpath\Filename.png>>
否则会得到一个空文档(至少在 publish
正在创建 .html 文件时)。
由于应共享记录的代码,我需要一个相对路径以避免以后出现问题。
MATLAB 中是否有任何解决方案或变通方法?
我之前的一些尝试:
% <<.\Filename.png>> # with and without "" or ''
% <<..\Filename.png>> # with and without "" or ''
% <<..\..\Filename.png>> # with and without "" or ''
图片没有出现。
假设这个目录结构:
这段代码,
function q51539865
%% Image From URL
%
% <<https://i.stack.imgur.com/zSPip.jpg>>
%
%% Image From Relative Path
%
% <<../InnerPath/zSPip.jpg>>
%
生成以下网页:
检查第 2nd 个图像时,我们看到: