How can i use cell array inside the imwrite?
Please help

댓글 수: 1

Stephen23
Stephen23 2017년 3월 7일
@Matt Kernan: you are storing image data in a cell array? Why? That would be quite inefficient.

댓글을 달려면 로그인하십시오.

 채택된 답변

KSSV
KSSV 2017년 3월 7일

2 개 추천

K = cell(3,1) ;
K{1} = rand(100) ;
K{2} = rand(200) ;
K{3} = rand(500) ;
for i = 1:length(K)
imwrite(K{1},strcat('image_K',num2str(i),'.jpg')) ;
end

댓글 수: 2

Matt Kernan
Matt Kernan 2017년 3월 7일
Thanks. But it is not working. When i run it, it gives me following error
"Expected DATA to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64, logical
Instead its type was cell."
Jan
Jan 2017년 3월 7일
@Matt: No, this is not possible. If you run KSSV's code, you cannot get this error. Please post the code you run, such that an improvement can be suggested.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Jan
Jan 2017년 3월 7일

0 개 추천

You cannot use a cell as input for imwrite. I cannot imagine the intention of doing this. Writing images is only useful for images, and images are either [Col x Row] or [Col x Row x 3] numerical arrays. So perhaps you want to deliver the contents of a cell element to the imwrite command. Then see KSSV's answer, which answers this question, as far as I can see.

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

제품

질문:

2017년 3월 7일

답변:

Jan
2017년 3월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by