       Adding a value to the cell of a matrix

• To: mathgroup at smc.vnet.net
• Subject: [mg75880] Adding a value to the cell of a matrix
• From: newbie <puretexan at gmail.com>
• Date: Sat, 12 May 2007 03:15:03 -0400 (EDT)

```I have a matrix of values that i am searching for a specific value in
and i want to count the number of occurances in each column. which i
can do but not in a loop.  I want to be able to use a matrix to store
the number of occurances so i can put it in a loop. I already have a
loop that finds the values and just adds them to a value i created. do
you know how i can add +1 to the cell of a matrix? When i try to do
this it says the values are protected. i tried unprotecting them but
couldn't get that to work.

any ideas?

Here is the code i am using for the search

In:=Orderedcellcycle=OverExpressed; (* Dimensions {200, 18}*)
l=matrix1;   (*{5164, 18}*)
Do[l[[All,i]]=Ordering[matrix1[[All,i]]],{i,1,18}];
Do[Do[Orderedcellcycle[[i,j]]=annotations[[l[[i,j]],6]],{i,1,200}],{j,
1,18}];

In:=gcounter=scounter=gmcounter=mgcounter=sgcounter=0;

In:=Do[Do[If[Orderedcellcycle[[i,j]]=="G1",gcounter=gcounter
+1,gcounter=\
gcounter+0],{i,1,200}];
Do[If[Orderedcellcycle[[i,j]]=="S",scounter=scounter+1,scounter=
scounter+0],{i,1,200}];
Do[If[Orderedcellcycle[[i,j]]=="S/G2",sgcounter=sgcounter
+1,sgcounter=
sgcounter+0],{i,1,200}];
Do[If[Orderedcellcycle[[i,j]]=="G2/M",
gmcounter=gmcounter+1,gmcounter=gmcounter+0],{i,1,200}];
Do[If[Orderedcellcycle[[i,j]]=="M/G1",mgcounter=mgcounter
+1,mgcounter=
mgcounter+0],{i,1,200}],{j,1,18}]

```

• Prev by Date: Re: Re: Re: How to get sqrt(Year^2)===Year?
• Next by Date: Block[], OpenRead[], & /@
• Previous by thread: interpolation look-up table?
• Next by thread: Re: Adding a value to the cell of a matrix