Subject: Re: closing notebook cells CellInformation[] - that sounds wonderful. But I have searched in help, the Wolfram site and Google, and also entered ??CellInformation, and I do not find any information anywhere! Please inform, how do I use it? Ingolf Dahl Sweden >-----Original Message----- === >Subject: closing notebook cells >> As I learned in mathgroup a few years ago I am using the following code >> to close automatically my graphics groups. >> CloseAnim[]:=(SelectionMove[EvaluationNotebook[],All,GeneratedCell]; >> FrontEndTokenExecute[OpenCloseGroup];); >> CloseAnim::usage = CloseAnim[]; >> For example: >> Table[Show[Graphics[ >> {Hue[Random[] ],Rectangle[{0,0},{1,1}] >> }]],{3}]; >> CloseAnim[]; >> The problem is that when I only generate a single cell OpenCloseGroup >> will generate a beep. >> Any idea on how to prevent that beep or test if GeneratedCell selected a >> single or several cells? >> Luc >LinkWrite[$ParentLink, CellInformation[EvaluationNotebook[]]]; >Length[LinkRead[$ParentLink]] >If the length is greater than 1, then you can use the OpenCloseGroup token. >CellInformation[] is new to version 5 and is, in general, a very good way >to test various properties of the selection without having to do a >NotebookRead[] (which could get very expensive if you have a selection >which consumes a lot of memory). >John Fultz >jfultz@wolfram.com >User Interface Group >Wolfram Research, Inc. === Subject: Re: Re: newbie question on functions You probably meant to use Append in your example of unexpected behaviour, since AppendTo works as one might hope. junk={1,2,3}; Append[junk,4] {1,2,3,4} junk {1,2,3} But AppendTo actually does what its name suggests: junk={1,2,3}; AppendTo[junk,4] {1,2,3,4} junk {1,2,3,4} christopherpurcell@mac.com AIM/iChatAV: cffrc >> Yes, of course you can save the result of a calculation. For example: >> result=intensity[4.,5.] > For the original newbie poster: > For newbies, or less expert users like me, it's easy to think that > something like > AppendTo[list, expr] > is a command that will do what it says: append expr to list. Takes a > few bad experiences to realize that you actually have to say > list = AppendTo[list,expr] > Same general principle applies more broadly. === Subject: Re: Re: newbie question on functions > For newbies, or less expert users like me, it's easy to think that > something like > AppendTo[list, expr] > is a command that will do what it says: append expr to list. Takes a > few bad experiences to realize that you actually have to say > list = AppendTo[list,expr] That's exactly wrong. For example: list={a,b} AppendTo[list,c]; list {a,b} {a,b,c} Bobby >> Yes, of course you can save the result of a calculation. For example: >> result=intensity[4.,5.] > For the original newbie poster: > For newbies, or less expert users like me, it's easy to think that > something like > AppendTo[list, expr] > is a command that will do what it says: append expr to list. Takes a > few bad experiences to realize that you actually have to say > list = AppendTo[list,expr] > Same general principle applies more broadly. -- DrBob@bigfoot.com www.eclecticdreams.net === Subject: Re: newbie question on functions > Yes, of course you can save the result of a calculation. For example: > result=intensity[4.,5.] For the original newbie poster: For newbies, or less expert users like me, it's easy to think that something like AppendTo[list, expr] is a command that will do what it says: append expr to list. Takes a few bad experiences to realize that you actually have to say list = AppendTo[list,expr] Same general principle applies more broadly. === Subject: Re: newbie question on functions Functional programming would be simpler. ratio[mat_?MatrixQ, col1_Integer, col2_Integer] := (Log[2,#[[1]]/#[[2]]]& /@ mat[[All,{col1,col2}]]) /; 1<=col1<=Length[mat[[1]]] && 1<=col2 <= Length[mat[[1]]]; intensity[mat_?MatrixQ, col1_Integer, col2_Integer] := (Log[2,#[[1]]*#[[2]]]& /@ mat[[All,{col1,col2}]]) /; 1<=col1<=Length[mat[[1]]] && 1<=col2 <= Length[mat[[1]]]; fmicroarray=Array[fma,{3,19}]; ratio[fmicroarray,18,19] {Log[fma[1, 18]/fma[1, 19]]/Log[2], Log[fma[2, 18]/fma[2, 19]]/Log[2], Log[fma[3, 18]/fma[3, 19]]/Log[2]} intensity[fmicroarray,18,19] {Log[fma[1, 18]*fma[1, 19]]/Log[2], Log[fma[2, 18]*fma[2, 19]]/Log[2], Log[fma[3, 18]*fma[3, 19]]/Log[2]} Bob Hanlon === > Subject: newbie question on functions > Hi all, > I have what is probably a nieve question, but it is giving me some difficulty. I am trying to generate a function in which I pass two columns of information from a matrix to this function to perform some calculations. I can successfully pass the data and get the resulting calculation......but the problem is the function returns the results but does not save the results in memory to perform subsequent calculations with. How can I get the function to keep the result? Is there a way to assign the function output to a new variable before mathematica discards the results. Does this behavior have anything to do with the Head of the function being symbolic, rather than say a list?? > Below is the relevant code: > SetAttributes[ratio,Listable]; > SetAttributes[intensity,Listable]; > ratio[cy3_,cy5_]:=Table[Log[2,(cy3/cy5)]]//N; > intensity[cy3_,cy5_]:=Table[Log[2,(cy3*cy5)]]//N; > ratio[Table[fmicroarray[[i,18]],{i,1,Length[fmicroarray]}], > Table[fmicroarray[[i,19]],{i,1,Length[fmicroarray]}]] > Todd === Subject: Set Options I am trying to convert a mathematica cell in to fortranform to run it in fortran. However I may have messed up the output text display by playing with the set options ..How do I return to the default setting pratik Desai === Subject: Re: plot variance(s) has more or less the same idea. > Input1: data = Table[Sin[x], {x, 0, 2[Pi]}]; > Input 2: p1 = ListPlot[data, > PlotStyle -> {Red, PointSize[0.03]}, DisplayFunction -> Identity]; > Input 3: p2 = Plot[Sin[x], {x, 0, 2[Pi]}, DisplayFunction -> Identity]; > Input 4: Show[p1, p2, DisplayFunction -> $DisplayFunction]; > Steven Shippee > slshippee@comcast.net > 360-493-8353 === Subject: Re: plot variance(s) because you should type data = Table[{x, Sin[x]}, {x, 0, 2[Pi]}]; Plot[Sin[x], {x, 0, 2Pi }, Epilog -> ({RGBColor[1, 0, 0], PointSize[0.03], Point[#]} & /@ data)] Jens Steven Shippee schrieb im Newsbeitrag > Input1: data = Table[Sin[x], {x, 0, 2[Pi]}]; > Input 2: p1 = ListPlot[data, > PlotStyle -> {Red, PointSize[0.03]}, DisplayFunction -> Identity]; > Input 3: p2 = Plot[Sin[x], {x, 0, 2[Pi]}, DisplayFunction -> Identity]; > Input 4: Show[p1, p2, DisplayFunction -> $DisplayFunction]; > Steven Shippee > slshippee@comcast.net > 360-493-8353