help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Having trouble creating an array with these conditions


From: James Sherman Jr.
Subject: Re: Having trouble creating an array with these conditions
Date: Sat, 17 Dec 2011 20:09:54 -0500

On Fri, Dec 16, 2011 at 1:06 AM, StudentinCrisis <address@hidden> wrote:
I'm supposed to create an array that uploads a .dat file. For example

numbers.dat has the following content:
6
0.5
2
3 3 5
1 1 4

6 is the width, 0.5 is the initial case and 2 is the number of sources, 3 3
5 indicates 3rd row and 3rd column should be filled with 5 and 11 4
indicates 1st row 1st column should be filled with 4

So for example (ignore the brackets):

[4.0000 0.5000 0.5000 0.5000 0.5000 0.5000]
[0.5000 0.5000 0.5000 0.5000 0.5000 0.5000]
[0.5000 0.5000 5.0000 0.5000 0.5000 0.5000]
[0.5000 0.5000 0.5000 0.5000 0.5000 0.5000]
[0.5000 0.5000 0.5000 0.5000 0.5000 0.5000]
[0.5000 0.5000 0.5000 0.5000 0.5000 0.5000]

I need to something to work with, I'm supposed to use this function:
function out = initGroup(grid, source1, source2, source3, source4). Any
ideas? I need some kind of direction.


How do you know how many rows your array is?  You say that the first number is the width (i.e. number of columns) but not the number of rows.

You could do something like the attached file (I just chose the number of rows to be equal to the number of columns).

Hope this helps.


Attachment: matrix_making.m
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]