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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:07:09+00:00 2026-06-18T23:07:09+00:00

I know its possible in Java and C++ etc, but is this possible in

  • 0

I know its possible in Java and C++ etc, but is this possible in Matlab?
I’ve recently discovered Matlab doesnt have short cuts like value++ instead they have to use value = value+1 so i’m wondering whether its possible to convert this function to an iterative one. I’m not sure where to start. If so, is it less beneficial than a recursive function?

    function [lines] = recurse(R,C, lines, T_l, count, directions)
    [rows, columns] = size(lines);
    if((R < 2 || C < 2) || (R > rows-1 || C > columns - 1) || count>500)
        count= count+1;
        return;
    end
    count= count+1;
    direction = directions(R,C);
            if(direction >= 68 || direction <=-68)                                          
                if(lines(R-1,C) > T_l)
                    lines(R-1,C) = 0;
                    lines = recurse(R-1,C, lines, T_l, count, directions);
                end
                if(lines(R+1,C) > T_l)
                    lines(R+1,C) = 0;
                    lines = recurse(R+1,C, lines, T_l, count, directions);
                end
            elseif (direction <= -23 && direction >-68)                                     
                if(lines(R+1,C+1) > T_l)
                    lines(R+1,C+1) = 0;
                    lines = recurse(R+1,C+1, lines, T_l, count, directions);
                end
                if(lines(R-1,C-1) > T_l)
                    lines(R-1,C-1) = 0;
                    lines = recurse(R-1,C-1, lines, T_l, count, directions);
                end
            elseif (direction >= 23 && direction < 68)                                      
                if(lines(R+1,C-1) > T_l)
                    lines(R+1,C-1) = 0;
                    lines = recurse(R+1,C-1, lines, T_l, count, directions);
                end
                if(lines(R-1,C+1) > T_l)
                    lines(R-1,C+1) = 0;                                                     
                    lines = recurse(R-1,C+1, lines, T_l, count, directions);
                end
            else                                                                            
                if(lines(R,C+1) > T_l)
                    lines(R,C+1) = 0;                                                           
                    lines = recurse(R,C+1, lines, T_l, count, directions);
                end
                if(lines(R,C-1) > T_l)
                    lines(R,C-1) = 0;
                    lines = recurse(R,C-1, lines, T_l, count, directions);
                end
            end
    lines(R,C) = 255;
    return;

Basically, i currently have a function that calls this second function recursively. I was hoping to consolidate this recursive function into the function calling it as a iterative set of commands.
I’m pretty sure it will be slower but speed isn’t an issue for me and i’m interested to see how the loops will work. Thanks.

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

    You can accomplish value++ using operator (you will need the symbolic toolbox though).

    operator(symb, f, T, prio) defines a new operator symbol symb of type T (Prefix | Postfix | Binary | Nary) with priority prio. The function f evaluates expressions using the new operator.

    Given the operator symbol “++”, say, with evaluating function f, the following expressions are built by the parser, depending on the type of the operator, where :

    Prefix: The input ++x results in f(x).

    Postfix: The input x++ results in f(x).

    Binary: The input x ++ y ++ z results in f(f(x, y), z).

    Nary: The input x ++ y ++ z results in f(x, y, z)).

    see more at matlab’s documentation.

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

Sidebar

Related Questions

I know its possible to create activities by doing something like the code bellow,
I know its possible to receive a dayClick event on Fullcalendar. But I would
i want to know if its possible to use a function like .delegate() ,
I would like to know if its possible to develop a selenium RC for
I know its possible to accept a list of objects as a parameter thanks
I know its possible to use a wakelock to hold the screen, cpu, ect
I know its possible to open an app from mobile safari using custom URL
I am doing an android applicaiton and I know its possible to show or
Anyone know if its possible to enable horizontal scrolling ONLY in a windows forms
Anyone know if its possible to yet create a css based drop shadow on

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.