MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem in generating a DO cycle (mathematica 6.0)

  • To: mathgroup at
  • Subject: [mg95353] Re: Problem in generating a DO cycle (mathematica 6.0)
  • From: dh <dh at>
  • Date: Fri, 16 Jan 2009 06:10:02 -0500 (EST)
  • References: <gkn5jk$ihb$>

Hi Valeria,

if I understand correctly, you have a matrix: m and want to change this 

into a vector: v, containing the elemnsts of m. In mathematica there are 

often easier ways than Do loops. In this case:


will return a vector containing the elements of m raw-wise (first 

raw,second raw..)


gives a vector column-wise.

hope this helps, Daniel

Valeria Volpe wrote:

> Dear all I have a problem in generating a DO cycle (mathematica 6.0).


> Through these commands I acquire a bitmap image from a my folder and create

> a "Graylevels" file:


> Quit;

> SetDirectory[ "C:\\Users\\...\\Dati\\\Bitmap\\\xxx"];

> nome = "p6a.bmp";

> Import[nome, "ImageSize"];

> row = ToExpression[Import[nome, "ImageSize"]][[1]];

> col = ToExpression[Import[nome, "ImageSize"]][[2]];

> vmax = row*col;

> gv = Array[f, vmax];

> gl = Import[nome, "GrayLevels"];



> at this point I have a matrix with all graylevels.


> Now my problem is to create a two DO cycle (one for rows and one for

> columns) which allow me to generate an array (gv) whose elements are the

> product row x column of the matrix:


> gv[i] = gl [j,k]


> where:

> {i,1,Vmax}

> {j,1,row}

> {k,1,col}


> Can you pleasa herlp me to generate these Do Cycle?


> Thanky

> Vale



  • Prev by Date: Re: Plot Lists of values from excel to mathematica
  • Next by Date: Re: Taking LCM in a polynomial expression
  • Previous by thread: Problem in generating a DO cycle (mathematica 6.0)
  • Next by thread: Re: Problem in generating a DO cycle (mathematica 6.0)