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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:31:55+00:00 2026-05-16T04:31:55+00:00

A have a struct with four very large matrices that correspond to grayscale images.

  • 0

A have a struct with four very large matrices that correspond to grayscale images. Depending on the input of my function, I want to store one of those four matrices in a variable. However, since those matrices are very large, I don’t want to create a copy of them.

Is there something similar in Matlab to the concept of reference in C++? Or in other words: is it possible to have two variables pointing to the same matrix?

  • 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-16T04:31:55+00:00Added an answer on May 16, 2026 at 4:31 am

    Matlab uses a “lazy copy on write” for variables. That means that if you pass your array (or all of them) to your function, they won’t be duplicated unless you write into the array(s). In other words, you may not need to do what you want to do.

    For example, if you store your images in a structure imgStruct with fields firstImage to fourthImage, and you pass e.g. imgStruct.fourthImage as input to the function, the array is not duplicated, even if it is called e.g. inputImage inside the function.

    If you plan to write to the image, you can create a handle class to store your image data, which is passed by reference (thus, if you modify the image inside the function, it is also modified in your base workspace).

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

Sidebar

Related Questions

In my C# application, I have a large struct (176 bytes) that is passed
I have a struct: struct s { UINT_PTR B_ID; }; s d; d.B_ID=0x1; That
I have a struct defined like follows as part of an object. I'm trying
I have this struct: struct Map { public int Size; public Map ( int
I have a struct like this: class Items { private: struct item { unsigned
Say I have a struct s with an int pointer member variable i. I
Is it possible in C# to have a Struct with a member variable which
I have the following struct in C++: #define MAXCHARS 15 typedef struct { char
I have a c# struct where I need to forbid calling the no args
I have a structure: struct pkt_ { double x; double y; double alfa; double

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.