Prev: Using dlmwrite to add a blank line
Next: looping
From: gunther on 29 Jul 2010 17:09 Hello! Given a square of the size ‘sq_size’. The area of the square is represented by the Square matrix A=zeros(sq_size). Given the number X, I want to turn X Elements of A into 1 by indexing A accordingly. Such that the elements that are turned into Ones are as evenly spaced as possible across the rows and colums of A. How can I do this for a general case, where I can enter any value for sq_size and X? It would be ok to use the round command if necessary to get an approximate solution. I would be greatful for your help. Thanks Forben
From: Walter Roberson on 29 Jul 2010 19:03 gunther wrote: > Given the number X, I want to turn X > Elements of A into 1 by indexing A accordingly. > Such that the elements that are turned into Ones are as evenly spaced as > possible across the rows and colums of A. Sounds like an assignment. What is meant by "as evenly spaced as possible across the rows and columns of A" ? For example, if A is 8 x 8 and you have 8 objects to place, filling all of one row or all of one column could be considered "evenly spaced" -- or would you fill one of the diagonals (if so, which one?) How do you measure the evenness of a proposed spacing?
|
Pages: 1 Prev: Using dlmwrite to add a blank line Next: looping |