arrayDatastore Read cut dimension
조회 수: 2 (최근 30일)
이전 댓글 표시
For a segmentation task I have a Hx Wx M items as matrix, I gonna convert into a logical array.
I would like to read these items into an arrayDatastore and tried following (simplified code):
for counter = 1:20
A= magic(10);
resultItem= cat(3,A,A,A);
result(counter,:,:,:)=resultItem;
end
result=logical(result<5& result>2);
ds=arrayDatastore(result,"ReadSize",1,"OutputType","same");
The read funktion sadly delivers a 1x4 dimensional array instead of 1x3. How can I clipp the first dimension - the counter - away ?
Or any other solution how to read everything into an arrayDatastore during a loop?
댓글 수: 0
답변 (1개)
Walter Roberson
2022년 4월 18일
result(:,:,:,counter)=resultItem;
댓글 수: 2
Walter Roberson
2022년 4월 18일
Sorry, it does not appear to be possible. The closest appears to be that you can return a scalar cell that is 3 dimensions. If you need a numeric return instead of a scalar cell then you are going to get a 4 dimensional object that you would then have to reshape() or permute() or squeeze()
for counter = 1:20
A = magic(10);
resultItem = cat(3,A,A,A);
result(:,:,:,counter) = resultItem;
end
result = logical(result<5& result>2);
ds = arrayDatastore(result,"ReadSize", 1, "OutputType", "cell", "IterationDimension", 4);
test1 = read(ds);
test2 = read(ds);
whos
size(test1{1})
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!