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 576743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:04:46+00:00 2026-05-13T14:04:46+00:00

Now I get a 5-d matrix which M[j][i][l][ref][0]… In this matrix, j,i belong to

  • 0

Now I get a 5-d matrix which M[j][i][l][ref][0]…

In this matrix, j,i belong to 0~4, while l=0. ref can vary from 0 to 4.

I just want to count the number according to ref’s value.

For example,

  • if ref =0, I will do count0++,
  • if ref =1, count1++,
  • if ref =2, count2++
  • …

So, I do not care what is the value of M, I just want to know the appearing frequency with different ref value.

Thanks.

  • 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-13T14:04:47+00:00Added an answer on May 13, 2026 at 2:04 pm

    You’re not quite clear on how what you want to do depends on the actual contents of M — I’m guessing this contains some sort of variable count you want to add to your individual counts?

    In this case, how about something like this:

    int j, i, ref;
    int counts[5];
    for(ref=0; ref<5; ref++)
        counts[ref]=0;
    for(j=0; j<4; j++)
        for(i=0; i<5; i++)
            for(ref=0; ref<5; ref++)
                counts[ref]+=M[j][i][0][ref][0];
    

    (I have replaced your individual “count” variables with an array, which makes things much easier.)

    Edit: I just saw that you don’t care what the contents of M are. In that case, I don’t really understand what you’re trying to do. Since the dimensions are constant, the number of entries that exist for a certain value of ref are always constant, and are always the same for all ref — in this case, 5*5=25, since you have five entries along each of the j and i dimensions.

    If this is not what you want, please clarify.

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

Sidebar

Related Questions

I have this code right now to get the row value from jquery grid..
How can I generate an episode with maven? I now get an error message:
Ive been trying for a while now to get a rich textbox to populate
I have been trying to days now to get this website completed ... however,
So this used to work without a hitch but now I get a Socket
I have been using a SAX parser for a while now to get data
right_now = datetime.datetime.now() one_hour_before = ????? How can I use right_now to get one_hour_before?
I think this must be simple but I can't get it right... I have
I've been struggling with this problem for a while now, searching every possible solution.
I can't seem to get this toString() method to work? The deepToString method works

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.