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

  • Home
  • SEARCH
  • 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 8245829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:18:48+00:00 2026-06-07T22:18:48+00:00

Given a multiple-input MATLAB function out=f(in1, in2) I would like to write a second

  • 0

Given a multiple-input MATLAB function

out=f(in1, in2) 

I would like to write a second function g which generates the inputs for f, e.g.

[in1, in2]=g(in)

so that I can call something like:

out=f(g(in))

I have tried writing g as a single output function that stores in1 and in2 in a cell array so that I can feed the output of g to f using the colon operator:

in_c=g(in);
out=f(in_c{:})

but I was looking for a one-line solution, which seems not possible to achieve this way as I read in this Stack Overflow question

Is there any other way to do this?

  • 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-07T22:18:50+00:00Added an answer on June 7, 2026 at 10:18 pm

    As discussed recently, this is not possible in Matlab.

    However, if you do not want to re-write your function g(x,y) to return a cell array, you can still do everything in two lines:

    [in4f{1}, in4f{2}] = g(in);
    out = f(in4f{:});
    

    As an aside: Unless you’re really hurting for memory, it doesn’t make a lot of sense to try and force one-line statements everywhere by avoiding temporary variables. Sure, you can make your code look like CrazyPerl, but in the long run, you’ll be glad for the added readability.

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

Sidebar

Related Questions

I would like to know the best way of parsing an input where multiple
I have a caret delimited (key=value) input and would like to extract multiple tokens
Given multiple HTML checkboxes: <input type=checkbox name=catIDs value=1 /> <input type=checkbox name=catIDs value=2 />
I have a form which has multiple input fields, and 3 main options. depending
Given the following input, how do I write a LINQ query or expression to
For all documents satisfying a given criteria, I would like to patch update a
Given multiple anchor tags: <a class=myclass href=...>My Text</a> How do I select the anchors
I want to have multiple multiple choices given to user after the form submit
Given: public interface IBatchProcess { void Run(); } and multiple implementation of: public class
If I have multiple Oracle clients installed on a given workstation (i.e. Oracle 9

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.