Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7067561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:13:01+00:00 2026-05-28T05:13:01+00:00

I have a matrix (5×5) with values in them for example: Matrix (1,1) Value:

  • 0

I have a matrix (5×5) with values in them for example:

Matrix (1,1) Value: ‘a’

Matrix (1, 2) Value: ‘b’

Matrix (2, 1) Value: ‘c’

how would I be able to find the letter ‘a’ in that matrix and have it output the coordinates?

ie

user inputs ‘b’

[searches for ‘b’ in table]

output (1,2)

thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:13:02+00:00Added an answer on May 28, 2026 at 5:13 am

    It’s as simple as:

    For i As Integer = 0 To LengthOfMatrix - 1
      For y As Integer = 0 To HeightOfMatrix - 1
        If Matrix(i, y) = "a" Then Console.Write(i & " " & y & vbCrLf)
      Next
    Next
    

    Asuming that you declared Matrix as:

    Dim Matrix As Char(,) = {{"a", "b", "c", "d", "e"}, {"a", "b", "c", "d", "e"}, {"a", "b", "c", "d", "e"}, {"a", "b", "c", "d", "e"}, {"a", "b", "c", "d", "e"}}
    

    And LengthOfMatrix And HeightOfMatrix should be the dimentions of your matrix. They could be switched to something more dynamic like:

    For i As Integer = 0 To Matrix.GetLength(0) - 1 'Get's the length of the first dimension
      For y As Integer = 0 To Matrix.GetLength(1) - 1 'Get's the length of the second dimension
        If Matrix(i, y) = "a" Then Console.Write(i & " " & y & vbCrLf)
      Next
    Next
    

    In a short description, all that this loop does is it goes through all of the elements of the matrix and outputs the coordinates of every element that matches a certain criteria (In this case – equals to ‘a’).


    Note: In most programming languages array’s indexes begin from 0, so the first element in your matrix will be at coords (0,0).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a matrix in MATLAB and I need to find the 99% value
If I have a matrix that is iterated horizontally and then vertically it would
I have a matrix 5x5 (25 nodes). Is there a formula that I can
I have a matrix that stores x, y and z values as so: {x1,
Have a matrix report now that has Position, Hours and Wages for a location
I have a matrix in SQL reporting and I would like it to print
I have a matrix in the type of a Numpy array. How would I
Suppose, in MATLAB, that I have a matrix, A, whose elements are either 0
I have a matrix class that takes the row and column reference type that
I have a matrix that is about 11,000 x 1,000, saved as a csv.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.