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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:43:19+00:00 2026-06-12T16:43:19+00:00

I have difficulties while converting the following matlab line into C++: for i=1:height for

  • 0

I have difficulties while converting the following matlab line into C++:

for i=1:height 
  for j=1:width 
    if (match == 0) 
      [min_w, min_w_index] = min(w(i,j,:)); 
      mean(i,j,min_w_index) = double(data(i,j)); 
      sd(i,j,min_w_index) = sd_init; 
    end
    rank = w(i,j,:)./sd(i,j,:); 
    rank_ind = [1:1:C];
  end
end

Especially I don’t know how to covert the “min_w_index” part. Could someone help me on this point?

  • 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-06-12T16:43:20+00:00Added an answer on June 12, 2026 at 4:43 pm

    Most common solution for min function in such case is

    int min_w = w[i][j][0];
    int min_w_index = 0;
    for (k = 1; k < maxk; k++)
       if (w[i][j][k] < min_w)
       {
           min_w = w[i][j][k];
           min_w_index = k;
       }
    

    Don’t forget that C++ has zero-based index, but Matlab one-based. I already see problem in your comment.

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

Sidebar

Related Questions

I have some difficulties with understanding BindingSource's behaviour. Let's look at following example: Creating
I have encountered some difficulties while training my nn. When I use, lets say,
I'm trying to animate a UITableView and running into difficulties. I have loaded the
I am having som slight difficulties with the following problem. I have initialized a
I have difficulties developing 4x1 widget for Android. This is the appprovider <?xml version=1.0
I know this question had been asked a hundred times, but I have difficulties
I am reading the book: Intel Threading Building Blocks. I often have difficulties understanding
I have some difficulties in my project. I got the RGB values from a
I have some difficulties for using Ruby block, passing in a method. As in
I'm have some difficulties here, I am unable to successfully call a method which

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.