Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Assigning entire row in a 2d array?

Reply
Thread Tools

Assigning entire row in a 2d array?

 
 
Tricky
Guest
Posts: n/a
 
      08-28-2009
Now, if I had made an array of arrays like this:

type array1_t is array(0 to 9) of integer;
type array2_t is array(0 to 9) of array1_t;

variable A : array2_t;

I can do assignments like this:

A(1) := (others => 0);

now, if I do this instead

type array_t is array(0 to 9, 0 to 9) of integer;

is there anyway I can do something similar to above (neat and tidy)?
or do I have to do it inside a for loop (a little annoying)?
 
Reply With Quote
 
 
 
 
h.e.
Guest
Posts: n/a
 
      08-28-2009
Tricky schrieb:
> Now, if I had made an array of arrays like this:
>
> type array1_t is array(0 to 9) of integer;
> type array2_t is array(0 to 9) of array1_t;
>
> variable A : array2_t;
>
> I can do assignments like this:
>
> A(1) := (others => 0);
>
> now, if I do this instead
>
> type array_t is array(0 to 9, 0 to 9) of integer;
>
> is there anyway I can do something similar to above (neat and tidy)?
> or do I have to do it inside a for loop (a little annoying)?


have you tried A := (others=>(others=>0)); ?
 
Reply With Quote
 
 
 
 
Tricky
Guest
Posts: n/a
 
      08-28-2009
On Aug 28, 10:56*am, "h.e." <(E-Mail Removed)> wrote:
> Tricky schrieb:
>
>
>
> > Now, if I had made an array of arrays like this:

>
> > type array1_t is array(0 to 9) of integer;
> > type array2_t is array(0 to 9) of array1_t;

>
> > variable A : array2_t;

>
> > I can do assignments like this:

>
> > A(1) := (others => 0);

>
> > now, if I do this instead

>
> > type array_t is array(0 to 9, 0 to 9) of integer;

>
> > is there anyway I can do something similar to above (neat and tidy)?
> > or do I have to do it inside a for loop (a little annoying)?

>
> have you tried A := (others=>(others=>0)); ?


That wont work, you'd have to do A := (others =>0) and that would
assign the entire 2d array.

I just want to assign a single row to 0, not every element.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning methods to objects, and assigning onreadystatechange to an XMLHttpRequest -- an inconsistency? weston Javascript 1 09-22-2006 09:33 AM
How to return entire row to compare against another row in ruby bww00amdahl@yahoo.com Ruby 7 07-04-2005 08:08 PM
ok I can do a totals row but how about a percentage row after each data row D ASP .Net Datagrid Control 0 05-23-2005 04:10 PM
highlight entire row in jeditorpane Peter Java 0 09-09-2004 04:03 AM



Advertisments