why I am having this "Cell contents assignment to a non-cell array object."error?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hadeer tawfik
am 29 Sep. 2016
Kommentiert: Hadeer tawfik
am 30 Sep. 2016
I am trying to store Approximation vector of every image in a CSV file , so that every column or every row in the CSV file represents an image, but I have this error and don't know how to fix it Cell contents assignment to a non-cell array object.
Cell contents assignment to a non-cell array object.
Error in haarallwave (line 100)
data{i}= [A1vec];
here is my code
srcFiles = dir('E:\sense\process\*.jpg'); % the folder in which ur images exists
for i = 1 : length(srcFiles)
filename = strcat('E:\sense\process\',srcFiles(i).name);
[X1,map]=imread(filename);
map=gray(256);
[c,s]=wavedec2(X1,3,'haar');
[H1,V1,D1] = detcoef2('all',c,s,1);
A1 = appcoef2(c,s,'haar',1);
V1img = wcodemat(V1,255,'mat',1); %wcodemat just for display
H1img = wcodemat(H1,255,'mat',1);
D1img = wcodemat(D1,255,'mat',1);
A1img = wcodemat(A1,255,'mat',1);
[H2,V2,D2] = detcoef2('all',c,s,2);
A2 = appcoef2(c,s,'haar',2);
V2img = wcodemat(V2,255,'mat',1);
H2img = wcodemat(H2,255,'mat',1);
D2img = wcodemat(D2,255,'mat',1);
A2img = wcodemat(A2,255,'mat',1);
subplot(2,2,1);
imshow(A1img);
colormap(map);
title('Approximation Coef. of Level 1');
subplot(2,2,2);
imagesc(H1img);
title('Horizontal detail Coef. of Level 1');
subplot(2,2,3);
imagesc(V1img);
title('Vertical detail Coef. of Level 1');
subplot(2,2,4);
imagesc(D1img);
title('Diagonal detail Coef. of Level 1');
figure;
subplot(2,2,1);
imagesc(A2img);
colormap(map);
title('Approximation Coef. of Level 2');
subplot(2,2,2)
imagesc(H2img);
title('Horizontal detail Coef. of Level 2');
subplot(2,2,3)
imagesc(V2img);
title('Vertical detail Coef. of Level 2');
subplot(2,2,4)
imagesc(D2img);
title('Diagonal detail Coef. of Level 2');
[H3,V3,D3] = detcoef2('all',c,s,3);
A3 = appcoef2(c,s,'haar',3);
V3img = wcodemat(V3,255,'mat',1);
H3img = wcodemat(H3,255,'mat',1);
D3img = wcodemat(D3,255,'mat',1);
A3img = wcodemat(A3,255,'mat',1);
figure;
subplot(2,2,1);
imagesc(A3img);
colormap(map);
title('Approximation Coef. of Level 2');
subplot(2,2,2)
imagesc(H3img);
title('Horizontal detail Coef. of Level 2');
subplot(2,2,3)
imagesc(V3img);
title('Vertical detail Coef. of Level 2');
subplot(2,2,4)
imagesc(D3img);
title('Diagonal detail Coef. of Level 2');
%A1vec = reshape(A1img,prod(size(A1img)),1);
%figure;
%imshow(log(abs(A1img)),[]), colormap(jet), colorbar
A1vec=reshape(A1img,1,[]);
magImage = abs(A1img).^2;
energy = sum(magImage(:))
data{i}= [A1vec];
end
csvwrite('csvlistenergy31113.dat',data)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156753/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156754/image.jpeg)
0 Kommentare
Akzeptierte Antwort
dpb
am 29 Sep. 2016
data must be an existing array of double or other non-cell type already.
clear data
before beginning the script.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Blue finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!