为什么我无法读取“无法读取文件”; topo60c'。没有这样的文件或目录。 MATLAB中的错误?

发布于 2025-02-09 14:41:55 字数 296 浏览 0 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花坊 2025-02-16 14:41:55

在映射工具箱文档的“确认”部分中,有一个有关示例数据源的注释:

https://uk.mathworks.com/help/map/map/dedication-and-acknowledgent.html

除了注意到,示例和示例数据文件中包含的信息(在 matlabroot /示例中找到EM>/工具箱/MAP/MAPDATA )是从公开可用的数字数据集中得出的。这些数据文件是为了方便映射Toolbox™用户提供的。 MathWorks®没有声称任何此数据都没有缺陷或错误,或者地理特征或名称的表示是最新或权威的。

您可以使用MATLAB(在Windows上)打开这些文件夹

winopen( fullfile( matlabroot, 'examples/map/data' ) )
winopen( fullfile( matlabroot, 'toolbox/map/mapdata' ) )

,也可以简单地使用上面的fullfile命令来识别路径并亲自导航。

我可以看到(matlab r2020b)topo60c在这些文件夹中的第一个文件中,默认情况下不在您的路径上,因为它在“示例”中,而不是工具箱目录:

因此,您可以:

  1. 将此文件夹添加到您的路径中,以便MATLAB可以看到文件:addpath(fullfile(matlabroot,'示例/map/map/data'));


  2. 在运行时将完整的文件路径引用到数据示例:load(FullFile(Matlabroot,'示例/MAP/DATA/TOPO60C.MAT'));

我希望选项2避免更改路径。


此外,文档的“栅格地理”部分还有另一个注释,详细介绍了该数据集应包含的内容

https://uk.mathworks.com/help/map/raster-geodata.html

当栅格的地理图由表面高程组成时,该地图也可以称为数字高程模型/矩阵(DEM),其显示为地形图。 DEM是数字地形模型(DTM)最常见的形式之一,它也可以表示为轮廓线,三角形的高程点,四元组,OCTREE或其他方式。

包含全局地形数据的topo60c mat-file是DEM的一个示例。在这个180 x 360矩阵中,每一行代表一个纬度,每列代表一个经度的一个程度。该矩阵的每个元素是平均高度,以米为单位 - 地球的一级区域与其行相对应。

鉴于它是从公开可用的数据中生成的(参考第一个文档报价),并且您现在知道它代表了什么数据(参考第二个文档报价),您可以在需要时复制一些替代数据。

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

Except where noted, the information contained in example and sample data files (found in matlabroot/examples/map/data and matlabroot/toolbox/map/mapdata) is derived from publicly available digital data sets. These data files are provided as a convenience to Mapping Toolbox™ users. MathWorks® makes no claims that any of this data is free of defects or errors, or that the representations of geographic features or names are up to date or authoritative.

You can open these folders from MATLAB (on Windows) using

winopen( fullfile( matlabroot, 'examples/map/data' ) )
winopen( fullfile( matlabroot, 'toolbox/map/mapdata' ) )

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:

file

So you could either:

  1. Add this folder to your path so that MATLAB can see the file: addpath(fullfile(matlabroot,'examples/map/data'));

  2. 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

When raster geodata consists of surface elevations, the map can also be referred to as a digital elevation model/matrix (DEM), and its display is a topographical map. The DEM is one of the most common forms of digital terrain model (DTM), which can also be represented as contour lines, triangulated elevation points, quadtrees, octree, or otherwise.

The topo60c MAT-file, which contains global terrain data, is an example of a DEM. In this 180-by-360 matrix, each row represents one degree of latitude, and each column represents one degree of longitude. Each element of this matrix is the average elevation, in meters, for the one-degree-by-one-degree region of the Earth to which its row and column correspond.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文