简体   繁体   English

八度/ GRASS GIS .mat导入错误:“ map_data”未定义

[英]Octave/GRASS GIS .mat import error: 'map_data' undefined

I have a Matlab script that calculates a certain terrain-parameter (describing the theoretical shelter from and exposure to wind) based on a digital terrain model. 我有一个Matlab脚本,可以根据数字地形模型计算特定的地形参数(描述理论上的避风和暴露于风中)。 The script works both in Matlab and Octave and yields a matrix. 该脚本可在Matlab和Octave中使用,并产生一个矩阵。 Now: I am trying to couple this with a GRASS GIS shell script. 现在:我正在尝试将其与GRASS GIS Shell脚本结合使用。 I can call the script from GRASS, but I have problems getting the output back into GRASS. 我可以从GRASS调用脚本,但是在将输出返回到GRASS时遇到问题。 One way is to use the .mat format. 一种方法是使用.mat格式。 The problem is, however: When I export the result of the calculation (with save -mat4-binary result.mat ans ) and try to import the .mat file into GRASS, the error is: 但是问题是:当我导出计算结果(使用save -mat4-binary result.mat ans )并尝试将.mat文件导入GRASS时,错误是:

ERROR: No 'map_data' array found in [...file] 错误:在[...文件]中找不到'map_data'数组

Similarly, when I load the file in Octave and try to display it 同样,当我在Octave中加载文件并尝试显示它时

load result.mat 
imagesc(map_data), axis equal, axis tight, colorbar

the error is 错误是

error: `map_data' undefined near line 19 column 9 错误:第19行第9列附近未定义“ map_data”
error: evaluating argument list element number 1 错误:评估参数列表元素编号1

When I export from Matlab, it is the same problem. 当我从Matlab导出时,这是同样的问题。

Where is the bug? 错误在哪里?

Any help is greatly appreciated. 任何帮助是极大的赞赏。

The "bug" is, your mat-file does not contain any variable named "map_data", I would guess your variable in the mat-file is named "ans". “错误”是,您的mat文件不包含任何名为“ map_data”的变量,我想您在mat文件中的变量名为“ ans”。 I would use res=load result.mat , then you get a struct with everything which is in the mat file. 我将使用res=load result.mat ,然后您将获得一个结构,其中包含res=load result.mat文件中的所有内容。 If you type in res. 如果输入res. autocomplete should list all variables inside the struct (not sure about octave), alternatively use fieldnames(res) to list all variable names. 自动完成功能应列出结构中的所有变量(不确定八度),或者使用fieldnames(res)列出所有变量名。

/Update: /更新:

I took a short look into the documentation of grass. 我看了一下草的文档。 It expects predefined variable names, all beginning with map_*. 它需要预定义的变量名,所有变量名都以map_ *开头。 Instead of 代替

save -mat4-binary result.mat ans

you should rename your variables to match the documentation and save them using 您应该重命名变量以匹配文档并使用

save -mat4-binary result.mat map_*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 避开八度缺少地图数据结构 - getting around octave's lack of map data structure 映射函数错误:无法读取Reactjs中未定义的属性“ map” - Map function error: Cannot read property 'map' of undefined in Reactjs 节点提取映射错误-无法读取未定义的属性“地图” - Node-Fetch Mapping Error - Cannot read property 'map' of undefined" 使用formtastic进行拆分和排列。 错误:未定义的方法“地图” - Splitting and array using formtastic. Error: undefined method `map' PHP错误。为什么array_map中的“变量未定义”? - PHP error. Why is “variable undefined” inside array_map? 错误:无法读取未定义的 REACT JS 的属性“地图” - Error:Cannot read property 'map' of undefined REACT JS 尝试按索引访问 Map 的数组值时出现未定义错误 - Undefined error when trying to access Array value of Map by index 错误类型错误:未定义不是 object(正在评估“state.map”) - ERROR TypeError: undefined is not an object (evaluating 'state.map') 尝试在 React 中使用 map 子对象时出现未定义错误 - Undefined error when trying to map child objects in React 使用 imresize 调整图像大小会导致八度误差 - Resize image using imresize gives an error in octave
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM