• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Subtract 3D matrix from 2D

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the code bellow which is for subtracting 3D Matrix from 2D , iam receiving error : Array index out of bound



any help please
 
Bartender
Posts: 5465
212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi nvayin,

how do you debug your programs?

If you look at the dimensions of the 2D arrays arr1[0] and arr2, you see that arr1[0] is 3 * 4, while arr2 = 2 * 4.
So, you get this error on arr2 in your test method.
 
nvayin agha
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The data that i have have these format:

a[][][]:

3.551777347914275 1.286875832907195
8.513771304610692 3.084699705412586

5.896962960211207 2.1365807531547536
6.477661799763445 2.346978880519314

7.447357702484369 2.6983179708520675
5.156151670042258 1.8681708691221717


and b[][]:

1.4 0.2
1.4 0.2
1.3 0.2
1.5 0.2
1.4 0.2
1.7 0.4
1.4 0.3


those are my data which i should use the method subtract on them
 
Piet Souris
Bartender
Posts: 5465
212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the look of it, a = 3 x 2 x 2, and b = 7 x 2.
How would you subtract one from the other?

Can you explain what it is you are trying to achieve?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic