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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:28:04+00:00 2026-05-11T05:28:04+00:00

I am looking for a way to store a large variable number of matrixes

  • 0

I am looking for a way to store a large variable number of matrixes in an array in MATLAB.

Are there any ways to achieve this?

Example:

for i: 1:unknown   myArray(i) = zeros(500,800); end 

Where unknown is the varied length of the array, I can revise with additional info if needed.

Update: Performance is the main reason I am trying to accomplish this. I had it before where it would grab the data as a single matrix, show it in real time and then proceed to process the next set of data.

I attempted it using multidimensional arrays as suggested below by Rocco, however my data is so large that I ran out of Memory, I might have to look into another alternative for my case. Will update as I attempt other suggestions.

Update 2: Thank you all for suggestions, however I should have specified beforehand, precision AND speed are both an integral factor here, I may have to look into going back to my original method before trying 3-d arrays and re-evaluate the method for importing the data.

  • 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. 2026-05-11T05:28:05+00:00Added an answer on May 11, 2026 at 5:28 am

    If all of the matrices are going to be the same size (i.e. 500×800), then you can just make a 3D array:

    nUnknown;  % The number of unknown arrays myArray = zeros(500,800,nUnknown); 

    To access one array, you would use the following syntax:

    subMatrix = myArray(:,:,3);  % Gets the third matrix 

    You can add more matrices to myArray in a couple of ways:

    myArray = cat(3,myArray,zeros(500,800)); % OR myArray(:,:,nUnknown+1) = zeros(500,800); 

    If each matrix is not going to be the same size, you would need to use cell arrays like Hosam suggested.

    EDIT: I missed the part about running out of memory. I’m guessing your nUnknown is fairly large. You may have to switch the data type of the matrices (single or even a uintXX type if you are using integers). You can do this in the call to zeros:

    myArray = zeros(500,800,nUnknown,'single'); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a way to store a very large image (e.g. 100.000x100.000 pixels)
We're looking for a way to log any call to stored procedures in Oracle,
I'm looking for any way that I can improve the selector performance of a
I'm looking for a very compact way of storing a dense variable length bitarray
I'm looking for a NoSQL-way to store machinedata like information about tools, work pieces,
Is there any way I could optimize the following script to run faster? foreach
I'm looking for a way to store a serialized value of eg. IDs in
I'm looking for a way to store application or machine level settings that can
So I am looking for a way to temporarily store values so they can
I'm looking for a good way to visualize ASP.NET session state data stored in

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.