Home > other >  Why am I getting "Unable to read file 'topo60c'. No such file or directory" erro
Why am I getting "Unable to read file 'topo60c'. No such file or directory" erro

Time:06-24

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.

CodePudding user response:

In the acknowledgements section of the mapping toolbox docs there is a note about example data sources:

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.

  • Related