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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:03:15+00:00 2026-06-09T20:03:15+00:00

I will run a set of experiments. The main method evaluated has the following

  • 0

I will run a set of experiments. The main method evaluated has the following signature:

[Model threshold] = detect(...
    TrainNeg, TrainPos, nf, nT, factors, ...
    removeEachStage, applyEstEachStage, removeFeatures);

where removeEachStage, applyEstEachStage, and removeFeatures are booleans. You can see that if I reverse the order of any of these boolean parameters I may get wrong results.

Is there a method in MATLAB that allows better organization in order to minimize this kind of error? Or is there any tool I can use to protect me against these errors?

  • 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-09T20:03:17+00:00Added an answer on June 9, 2026 at 8:03 pm

    Organization with a struct

    You could input a struct that has these parameters as it’s fields.

    For example a structure with fields

    setts.TrainNeg
         .TrainPos
         .nf
         .nT
         .factors
         .removeEachStage
         .applyEstEachStage
         .removeFeatures
    

    That way when you set the fields it is clear what the field is, unlike a function call where you have to remember the order of the parameters.

    Then your function call becomes

    [Model threshold] = detect(setts);
    

    and your function definition would be something like

    function [model, threshold] = detect(setts)
    

    Then simply replace the occurrences of e.g. param with setts.param.

    Mixed approach

    You can also mix this approach with your current one if you prefer, e.g.

    [Model threshold] = detect(in1, in2, setts);
    

    if you wanted to still explicitly include in1 and in2, and bundle the rest into setts.

    OOP approach

    Another option is to turn detect into a class. The benefit to this is that a detect object would then have member variables with fixed names, as opposed to structs where if you make a typo when setting a field you just create a new field with the misspelled name.

    For example

    classdef detect()
    properties
      TrainNeg = [];
      TrainPos  = [];
      nf = [];
      nT = [];
      factors = [];
      removeEachStage = [];
      applyEstEachStage = [];
      removeFeatures =[];
    end
    methods
      function run(self)
        % Put the old detect code in here, use e.g. self.TrainNeg to access member variables (aka properties)
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I set form number four as the default form that will run
My employer has developed a utility that will run a stored procedure line by
So, I set up a cronjob to run the following command: php /var/www/path/to/cron/do-stuff.php The
I am writing a set of database-driven applications in PHP. These applications will run
I need to create a persistent Java based application that will run at set
I have been tasked with writing a program which will run a set of
I want to set in whitch browser will run my WPF browser app. Is
I'm trying to write a shell script that, when run, will set some environment
I'm implementing an OAuth consumer, which will run on various set-top-boxes. Some of them
I am trying to set up an alarm that will run in the background

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.