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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:36:55+00:00 2026-05-27T10:36:55+00:00

I have code like this: JSenin1 = [1 0 1 3 ;1 0 1

  • 0

I have code like this:

JSenin1 = [1 0 1 3 ;1 0 1 3 ;1 0 1 3 ;0 0 0 0 ;0 0 0 0 ;1 1 0 4 ;1 1 0 4 ;1 1 0 4 ;1 1 0 4 ;0 0 0 0];
JSenin2 = [1 0 0 3 ;1 0 0 3 ;1 1 1 3 ;1 1 1 2 ;1 1 1 2 ;0 0 0 0 ;1 1 0 4 ;1 1 0 4 ;1 1 0 4 ;1 1 0 4];
JSenin3 = [1 1 1 3 ;1 1 1 3 ;1 1 1 3 ;0 0 0 0 ;0 0 0 0 ;0 0 0 0 ;1 0 0 4 ;1 0 0 4 ;1 0 0 4 ;1 0 0 4];
JSenin4 = [1 0 0 3 ;1 0 0 3 ;1 0 0 3 ;0 0 0 0 ;1 0 1 2 ;1 0 1 2 ;0 0 0 0 ;1 1 0 3 ;1 1 0 3 ;1 1 0 3];

i = 1;
jadwal = 0;
while i < 11
    a = eq(1, JSenin1(i, 1));
    b = eq(1, JSenin2(i, 1));
    c = eq(1, JSenin3(i, 1));
    d = eq(1, JSenin4(i, 1));

    if a == 1
        fungsi1(JSenin1, JSenin2, JSenin3, JSenin4, i)
        i = fungsi1(i); %I want to take value "i" back from "fungsi1".

    elseif b == 1

    elseif c == 1

    elseif d == 1

    end
    i = i + 1;
end

That called a function like this one:

function [ jadwal,i ] = fungsi1( JSenin1,JSenin2,JSenin3,JSenin4,i )

    %UNTITLED Summary of this function goes here.
    %   Detailed explanation goes here.

    a = eq(JSenin1(i,1),JSenin2(i,1));
    b = eq(JSenin1(i,1),JSenin3(i,1));
    c = eq(JSenin1(i,1),JSenin4(i,1));
    if a == 1 && b == 1 && c == 1
        d = eq(JSenin1(1,4),JSenin2(1,4));
        e = eq(JSenin1(1,4),JSenin3(1,4));
        f = eq(JSenin1(1,4),JSenin4(1,4));
        if d == 1 && e == 1 && f == 1
            jadwal = ([JSenin1(i,2:3);JSenin2(i,2:3);JSenin3(i,2:3);JSenin4(i,2:3)]);
            i = i + JSenin1(i,4) - 1; %I need to take this variable,
                                      %but I got myself an error.
        elseif d == 1 && e == 1 && f == 0
        elseif d == 1 && e == 0 && f == 1
        elseif d == 0 && e == 1 && f == 1
        end
    end
end

Error messages:

ans =

     0     1
     0     0
     1     1
     0     0

??? Input argument "i" is undefined.

Error in ==> fungsi1 at 4
a = eq(JSenin1(i,1),JSenin2(i,1));

Error in ==> Tes at 16
        i = fungsi1(i);

I’ve also read the Stack Overflow question Input argument undefined – MATLAB function/subfunction, but still I have no clue.

  • 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-27T10:36:56+00:00Added an answer on May 27, 2026 at 10:36 am

    Is this what you mean to do?

    [jadwal, i] = fungsi1(JSenin1,JSenin2,JSenin3,JSenin4,i)
    

    Calling functions with multiple output arguments

    Suppose you write a function like the following:

    function [a_squared, a_cubed] = square_and_cube(a)
    a_squared = a^2;
    a_cubed = a^3;
    

    You would then call that function like this:

    a = 2;
    [a_squared, a_cubed] = square_and_cube(a);
    disp(a_squared) % -> 4
    disp(a_cubed)   % -> 8
    

    I think one of your confusions is with the naming. It’s maybe less confusing if I call it like this:

    x = 2;
    [x_squared, x_cubed] = square_and_cube(x);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code like this: string result = xml.Root.Descendants(XYZ).Descendants(ABC).Descendants(MNO).Single().Value; 1) Is there a better
I have code like this: // Take the xml message and turn it into
I have code like this: var newMsg = new Msg { Var1 = var1,
I have code like this: template <typename T, typename U> struct MyStruct { T
I have code like this to move the player in my game left, right,
I have code like this var MyObj = { f1 : function(o){ o.onmousedown =
I have code like this: ... entry.KeyPressEvent += EntryKeyPressEvent; ... } void EntryKeyPressEvent(object o,
I have code like this: string uriString = @C:\Temp\test.html; Uri uri = new Uri(uriString);
I have code like this: MediaElement me = myPlayer.MediaElement; WriteableBitmap wb = new WriteableBitmap(me.NaturalVideoWidth,
I have code like this (simplified): def outer(): ctr = 0 def inner(): ctr

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.