Cell Contents Assignment To A Non-Cell Array Object

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)

Maybe this might help:

function Apply_Callback(hObject, eventdata, handles) global I

data = importdata('LDA data.mat')

features=data(:,1:end-1); %split data without labels

lable = data(:,end); %get the labels from training data

trainSamples = features;%training samples

trainClasses = lable;%training labels

I2 = reshape(I,[],1);

testSamples = I2;%test samples

lableimage = reshape(handles.lableimage,[],1);

testClasses = lableimage;%test labels

mLDA = LDA(trainSamples, trainClasses);

mLDA.Compute();

transformedTrainSamples = mLDA.Transform(trainSamples, 1);

transformedTestSamples = mLDA.Transform(testSamples, 1);

calculatedClases = knnclassify(transformedTestSamples,

transformedTrainSamples, trainClasses);

simmilarity = [];

for i = 1 : 1 : length(testClasses)

similarity(i) = ( testClasses{i} == calculatedClases{i} );

end

accuracy = sum(similarity) / length(testClasses);

fprintf('Testing: Accuracy is: %f %%\n', accuracy*100);

guidata(hObject, handles);

% hObject handle to Apply (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)

0 Replies to “Cell Contents Assignment To A Non-Cell Array Object”

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *