为什么我无法读取“无法读取文件”; topo60c'。没有这样的文件或目录。 MATLAB中的错误?
MATLAB的许多映射工具箱示例都需要“ topo60c”世界地图数据。 但是,这是一个示例
load topo60c
axesm hatano
meshm(topo60c,topo60cR)
zlimits = [min(topo60c(:)) max(topo60c(:))];
demcmap(zlimits)
colorbar
,当我运行上述脚本时,MATLAB显示“ Topo60c”的未找到错误。有人知道为什么我会遇到这个错误吗?我已经安装了映射工具箱,它可以与其他不引用该文件的映射示例代码一起使用。
Many of Matlab's Mapping toolbox examples require "topo60c" world map data. Here's an example
load topo60c
axesm hatano
meshm(topo60c,topo60cR)
zlimits = [min(topo60c(:)) max(topo60c(:))];
demcmap(zlimits)
colorbar
However, when I run the above script, Matlab displays a file not found error for "topo60c". Does anyone know why I'm getting this error? I have the Mapping toolbox installed, and it works with other Mapping sample code that doesn't reference that file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在映射工具箱文档的“确认”部分中,有一个有关示例数据源的注释:
https://uk.mathworks.com/help/map/map/dedication-and-acknowledgent.html
您可以使用MATLAB(在Windows上)打开这些文件夹
,也可以简单地使用上面的
fullfile
命令来识别路径并亲自导航。我可以看到(matlab r2020b)
topo60c
在这些文件夹中的第一个文件中,默认情况下不在您的路径上,因为它在“示例”中,而不是工具箱目录:因此,您可以:
将此文件夹添加到您的路径中,以便MATLAB可以看到文件:
addpath(fullfile(matlabroot,'示例/map/map/data'));
在运行时将完整的文件路径引用到数据示例:
load(FullFile(Matlabroot,'示例/MAP/DATA/TOPO60C.MAT'));
我希望选项2避免更改路径。
此外,文档的“栅格地理”部分还有另一个注释,详细介绍了该数据集应包含的内容
https://uk.mathworks.com/help/map/raster-geodata.html
鉴于它是从公开可用的数据中生成的(参考第一个文档报价),并且您现在知道它代表了什么数据(参考第二个文档报价),您可以在需要时复制一些替代数据。
In the acknowledgements section of the mapping toolbox docs there is a note about example data sources:
https://uk.mathworks.com/help/map/dedication-and-acknowledgment.html
You can open these folders from MATLAB (on Windows) using
Or simply use the
fullfile
commands above to identify the paths and navigate there yourself.I can see (MATLAB R2020b) the
topo60c
file within the first of these folders, which isn't on your path by default because it's within "examples" and not a toolbox directory:So you could either:
Add this folder to your path so that MATLAB can see the file:
addpath(fullfile(matlabroot,'examples/map/data'));
Reference the full file path to the data when running examples:
load(fullfile(matlabroot,'examples/map/data/topo60c.mat'));
I would prefer option 2 to avoid changing the path.
Additionally, there is another note in the Raster Geodata section of the docs which details what that dataset should contain
https://uk.mathworks.com/help/map/raster-geodata.html
Given that it's generated from publically available data anyway (ref the first docs quote) and you now know what data it represents (ref the 2nd docs quote), you could replicate some replacement data if really needed.