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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:10:43+00:00 2026-06-02T11:10:43+00:00

I have been on a few forum posts now reading through trying to figure

  • 0

I have been on a few forum posts now reading through trying to figure this out but I can’t seem to crack it. To summarise my function I have 2 arrays searchDates and searchIds. Now all I want to do is do a comparison on the size of one of the elements to the other array and this is the code I have so far but I don’t know how to carry over searchDates and searchIds

function a = compare(userNum)
if size(searchDates{1,userNum},2) == size(searchIds{1,userNum},2)
    x = true
else x = false
end

TL;DR I just need to know how to pass from my BASE WORKSPACE to my FUNCTION WORKSPACE the two arrays from above.

Cheers!

  • 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-02T11:10:45+00:00Added an answer on June 2, 2026 at 11:10 am

    You can rewrite your function so that you can directly pass the arrays:

    function a = compare(userNum,searchDates,searchIds)
    if size(searchDates{1,userNum},2) == size(searchIds{1,userNum},2)
        x = true
    else x = false
    end
    

    then call compare with your workspace variables in the 2nd and 3rd argument.
    If for some reason you need compare to only have one argument, you can create an anonymous function in your workspace by using the above function compare and writing:

    anon_compare = @(userNum) compare(userNum,searchDates,searchIds)
    

    Provided searchDAtes and searchIds are in your workspace, you will now have the function anon_compare, which you can use directly as anon_compare(foo).

    For more on anonymous functions (an important aspect of several MATLAB programming techniques) you can read this post.

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

Sidebar

Related Questions

I have been trying to figure out how all this validation works, but I
I have been reading the many posts on this topic and have been trying
I have been playing with this one for a few days now, and keep
I have been unable to figure out this problem - it just doesn't make
I have been using WPF for a few years now and don't have any
I have been using the Infragistics UltraWebGrids for a few years now in multiple
I have been wrestling with this for a few days and after tons of
I have been using Subversion for a few days now and have a question...
so I've been fighting with this for a few days, and I just can't
I've found a few posts that are similar in nature to this but they

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.