文档帮助中心
本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。
合并来自多个数据存储的数据
dsnew = combine(ds1,ds2,...,dsN)
示例
dsnew = combine(ds1,ds2,...,dsN) 通过水平串联 read 函数对输入数据存储返回的数据,合并两个或多个数据存储。
dsnew
ds1,ds2,...,dsN
read
全部折叠
创建一个数据存储,用于维护基础数据存储的图像对之间的奇偶校验。例如,创建两个单独的图像数据存储,然后创建一个从这两个图像数据存储中读取对应图像的组合数据存储。
创建一个表示三个图像的集合的数据存储 imds1。
imds1
imds1 = imageDatastore({'street1.jpg','street2.jpg','peppers.png'});
通过将 imds1 的图像转换为灰度图像,创建第二个数据存储 imds2。
imds2
imds2 = transform(imds1,@(x) rgb2gray(x));
基于 imds1 和 imds2 创建一个合并的数据存储。
imdsCombined = combine(imds1,imds2);
从合并的数据存储中读取第一对图像。对此合并的数据存储的每次读取操作都会返回一对图像,表示为 1×2 元胞数组。
1
2
dataOut = read(imdsCombined)
dataOut=1×2 cell array {480x640x3 uint8} {480x640 uint8}
显示对合并数据存储的第一次读取的输出。
imshow(imtile(dataOut));
要合并的数据存储,指定为两个或多个以逗号分隔的数据存储对象。有关内置数据存储的完整列表,请参阅Select Datastore for File Format or Application。您还可以指定自定义数据存储。
CombinedDatastore
具有合并数据的新数据存储,以 CombinedDatastore 对象形式返回。
dsnew 对象是一个新数据存储实例,它是对每个基础数据存储进行读取操作的水平串联结果。
CombinedDatastore | hasdata | preview | read | readall | reset | transform
hasdata
preview
readall
reset
transform
您的系统上存在此示例的修改版本。是否要打开此版本?
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office