# Thread Subject: All the pixel value in c multiply ( c(i*j)*c(i*j) ) and add to Z.

 Subject: All the pixel value in c multiply ( c(i*j)*c(i*j) ) and add to Z. From: Ananth Date: 5 Jul, 2012 23:22:08 Message: 1 of 3 Please correct the following coding c=imread('2.bmp'); z=0; for i=1:row1     for j=1:col1    z=z+(c(i,j)*c(i,j));     end end disp('Z'); disp(z); It is not working Properly. Its shows one constant value, to change any row1 & col1 value. I want the all the pixel value in c multiply ( c(i*j)*c(i*j) ) and add to Z.
 Subject: All the pixel value in c multiply ( c(i*j)*c(i*j) ) and add to From: Nasser M. Abbasi Date: 5 Jul, 2012 23:29:46 Message: 2 of 3 On 7/5/2012 6:22 PM, Ananth wrote: > Please correct the following coding > c=imread('2.bmp'); > z=0; > for i=1:row1 > for j=1:col1 > z=z+(c(i,j)*c(i,j)); > end > end > disp('Z'); > disp(z); > > It is not working Properly. Its shows one constant value, to change any row1 & col1 value. > I want the all the pixel value in c multiply ( c(i*j)*c(i*j) ) and add to Z. > What is 'row1' and 'col1' above? Where did they come from? Are you trying something like t=c.*c; sum(t(:)) ? --Nasser
 Subject: All the pixel value in c multiply ( c(i*j)*c(i*j) ) and add to From: Bruno Luong Date: 6 Jul, 2012 06:51:08 Message: 3 of 3 sum(c(:).^2) or norm(c(:))^2 % Bruno

Separated by commas
Ex.: root locus, bode

### What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.