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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:54:55+00:00 2026-06-12T10:54:55+00:00

I am using symbolic toolbox to generate a matlab function. But the number of

  • 0

I am using symbolic toolbox to generate a matlab function. But the number of input to the generated function is varying with the number of objects that I need (e.g., number of switches). For 2 and 3 switches the generated function look likes this :

y = fun(a1,a2,b1,b2)
y = fun(a1,a2,a3,b1,b2,b3)

In the script using this function I establish vectors of these parameters:

a = [a1 a2 ...]

What I want is to either call the generated function directly or make a wrapper function, so that I do not need to change the call statement when I change the number of switches. To complicate this problem even more, these variables are ACADO variables. That means that matrix and element-wise operation is not allowed (i.e., all math operation must be done with scalars, and equations in symbolic toolbox must be written for scalars).

  • 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-12T10:54:56+00:00Added an answer on June 12, 2026 at 10:54 am

    You probably look for cell arrays and the {:} operator. It changes the contents of the cell to a coma separated list. The result can be passed to a function as parameters. For example:

    v2 = {a1, a2, b1, b2};
    v3 = {a1, a2, a3, b1, b2, b3};
    

    And an example function:

    function fun(varargin)
        display(['number of parameters: ' num2str(nargin)]);
    

    You can call the function for different number of parameters ‘transparently’ as follows

    fun(v2{:})
    number of parameters: 4
    
    fun(v3{:})
    number of parameters: 6
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Matlab Symbolic Toolbox with its solve function and attempting to solve
Ok, I am trying to create a symbolic link using php symlink() function, but
Using Python I want to create a symbolic link pointing to a path that
Considering the symbolic constants using macros,enumeration constants and const objects. In macros scope is
I'm writing a genetic program to perform symbolic regression on a formula. I'm using
I need to write some code that deals with generating and manipulating multivariable polynomials.
I am trying to differentiate the following symbolic expression using a created symbolic vector
I tried to create a symbolic link in the Python site-packages directory using the
I am trying to write a Matlab program that accepts variables for a system
I have a /usr/lib/libtiff.so.3 as a symbolic link to /usr/lib/i386-linux-gnu/libtiff.so.4.3.3 . I need to

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.