我使用cat
函数堆叠了10张图片,获得了标记为myImage的图像堆栈,其尺寸为:100x100x10
(每张图片都有100x100
维度)。我想使用write_gdf
将此文件转换为GDF文件。但是,当我尝试运行此转换时,
myImage = cat(3,X{1:NumberOfFiles});
s = write_gdf('stack.gdf',myImage);
我希望s
成为尺寸为100x100x10
的3D矩阵,其值等于myImage
的值。相反,我只是将s变为一维变量:s=3
。
在write_gdf
帮助中,提到了:
NAME:
write_gdf
PURPOSE:
write data files in gdf format.
CATEGORY:
General Purpose Utility
CALLING SEQUENCE:
fid = write_gdf(filename,data)
INPUTS:
file: Complete pathname of the file to be written.
OUTPUTS:
data: Data structure. For example, if the original
data was stored as an array of bytes, then
DATA will be returned as an array of bytes also.
RESTRICTIONS:
Current implementation does not support structures or
arrays of structures.
PROCEDURE:
Reasonably straightforward.
Determines if the file is ASCII or binary, reads the size
and dimension info from the header, and reads in the data
请帮忙。提前谢谢!
答案 0 :(得分:1)
我认为帮助部分会产生误导。如果您检查the code,您会发现以下内容:
function [fid]=write_gdf(fn, data)
fid=fopen(fn,'w');
注意:我删除了所有不相关的代码部分
您向函数提供文件名(fn
)和数据(data
)。在内部,它在文件名上调用fopen
并将文件ID存储在fid
中。来自fopen
文档:
fileID:打开文件的文件标识符,指定为整数。
这是Matlab这个函数的唯一输出。这就是你所看到的s=3
。
为什么帮助段落说:
% OUTPUTS:
% data: Data structure. For example, if the original
% data was stored as an array of bytes, then
% DATA will be returned as an array of bytes also.
我只能猜测。也许这意味着data
是输出到文件(但不是Matlab)。这可能只是解释如何数据“输出”到文件中。