why I am having this "Cell contents assignment to a non-cell array object."error?
Afficher commentaires plus anciens
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)


Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Neuroimaging dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!