Results 1 to 11 of 11

Thread: help in matrix

  1. #1
    eng_hyzoom is offline Member
    Join Date
    Oct 2010
    Posts
    20
    Rep Power
    0

    Default help in matrix

    hello i hope you are all fine
    if i want to do something in a each row every one separated
    for example this matrix
    3 4 5
    2 1 3
    6 3 1
    i want to say if all elements of row >=3 put all elements of this row=0
    we find in this example second row verify this condition
    i want new matrix to be
    3 4 5
    0 0 0
    6 3 1
    i want this code please
    thanks a lot

  2. #2
    eng_hyzoom is offline Member
    Join Date
    Oct 2010
    Posts
    20
    Rep Power
    0

    Default Re: help in matrix

    no help ?????

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: help in matrix

    You would need some loops to do that. What code have you tried?
    Post your code and show its output
    or post the error messages you are getting.

  4. #4
    eng_hyzoom is offline Member
    Join Date
    Oct 2010
    Posts
    20
    Rep Power
    0

    Default Re: help in matrix

    Quote Originally Posted by Norm View Post
    You would need some loops to do that. What code have you tried?
    Post your code and show its output
    or post the error messages you are getting.
    thanks a lot
    code iam working in is very complex
    can you solve the posted example ?
    no error message i want idia doing this
    thanks again

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: help in matrix

    Just post code to solve the posted example. Leave the rest of your code off.
    Make a simple program that compiles and executes with a 2D array and some loops for solving the shown example.

  6. #6
    eng_hyzoom is offline Member
    Join Date
    Oct 2010
    Posts
    20
    Rep Power
    0

    Default Re: help in matrix

    Quote Originally Posted by Norm View Post
    Just post code to solve the posted example. Leave the rest of your code off.
    Make a simple program that compiles and executes with a 2D array and some loops for solving the shown example.
    i want help if i know i wouldnt ask
    i want code solve posted example

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: help in matrix

    You should hire a programmer if you want someone to write your code for you.
    We'll help you get your code to work. We don't write code to solve peoples' problems.

    You said:
    code iam working in is very complex
    If that is true then this little bit of code will be much simpler.
    All it needs is some loops and if statements.

  8. #8
    eng_hyzoom is offline Member
    Join Date
    Oct 2010
    Posts
    20
    Rep Power
    0

    Default Re: help in matrix

    Quote Originally Posted by Norm View Post
    You should hire a programmer if you want someone to write your code for you.
    We'll help you get your code to work. We don't write code to solve peoples' problems.

    You said:
    If that is true then this little bit of code will be much simpler.
    All it needs is some loops and if statements.
    thanks i learned today new lesson in programming
    iam quick boredom from thinking and it is assignment must received after tomorrow
    i want finish it and get market and i dont care about learning
    thanks again Norm and i will try to solve it

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,305
    Rep Power
    25

    Default Re: help in matrix

    i dont care about learning
    Then you have come to the wrong place.

  10. #10
    subzero1012 is offline Member
    Join Date
    Feb 2012
    Location
    Phoenix, AZ
    Posts
    26
    Rep Power
    0

    Default Re: help in matrix

    I'm unclear about the example output you've posted back in the original post. In your problem statement, you stated the following.

    i want to say if all elements of row >=3 put all elements of this row=0
    Don't you want the first row to be changed to 0's instead of the second row?

  11. #11
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,344
    Blog Entries
    7
    Rep Power
    20

    Default Re: help in matrix

    Quote Originally Posted by eng_hyzoom View Post
    hello i hope you are all fine
    if i want to do something in a each row every one separated
    for example this matrix
    3 4 5
    2 1 3
    6 3 1
    i want to say if all elements of row >=3 put all elements of this row=0
    we find in this example second row verify this condition
    i want new matrix to be
    3 4 5
    0 0 0
    6 3 1
    i want this code please
    thanks a lot
    I don't understand the condition why a row should be set to zeros, but the code is as simple as this:

    Java Code:
    for (int i= 0; i < matrix.length; i++)
       if (hyzoomCondition(matrix[i]))
          Arrays.fill(matrix[i], 0);
    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Matrix
    By awesom in forum New To Java
    Replies: 9
    Last Post: 10-05-2011, 08:36 PM
  2. Help with dox matrix printer
    By Albert in forum Advanced Java
    Replies: 7
    Last Post: 09-06-2011, 08:50 AM
  3. Matrix class
    By maz22 in forum New To Java
    Replies: 5
    Last Post: 10-15-2010, 06:53 AM
  4. help in matrix
    By Engineer in forum New To Java
    Replies: 7
    Last Post: 10-06-2010, 01:26 PM
  5. Help with matrix
    By susan in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 04:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •