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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:10:54+00:00 2026-05-30T22:10:54+00:00

I have a struct (of matrices) in Matlab that has been saved on the

  • 0

I have a struct (of matrices) in Matlab that has been saved on the harddisk. I currently use load to load these files inside my functions. Do you have any suggestions of doing this someother way that is much faster?

(Yes, I can pass the struct as a variable to my function but that is not possible due to memory issues!). Thanks! This would be a great help!

A = struct('local', randn(200000,14), 'usd', randn(200000,14), ...
          'ttm', randn(180000,14), 'avg', randn(190000,14), ...
          'ttm1yr', randn(190000,14), 'avg1yr', randn(190000,14)) ;
save('A.mat', 'A') ;                     clear all;clc

tic, load A.mat, A=A.local; toc  %--> Takes 1.05 seconds
  • 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-30T22:10:56+00:00Added an answer on May 30, 2026 at 10:10 pm

    It appears that you’re interested only in specific chunks of your saved file. I would suggest changing the format of the saved data so that individual variables can be loaded using the

    S = load(filename, variables)
    

    form of load. This will speed up the loading significantly, since you’ll avoid copying all of the unwanted data from disk into memory, just to free it right away.

    If your data is already in struct form, you can use this form of save (from the online docs):

    save(filename, ‘-struct’, structName, fieldNames) stores the fields of
    the specified scalar structure as individual variables in the file. If
    you include the optional fieldNames, the save function stores only the
    specified fields of the structure. You cannot specify variables and
    the ‘-struct’ keyword in the same call to save.

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

Sidebar

Related Questions

I have a struct, MyStruct , that has a private member private bool[] boolArray;
A have a struct with four very large matrices that correspond to grayscale images.
For an assignment at school, we have to use structs to make matrices that
I have a struct that contains three lists and an integer as can be
I have a struct that looks something like: struct foo_t { template <std::size_t x,
I have a struct Primitive, which has the following definition: typedef struct Primitive {
I have a function that multiply two matrices A and B then prints the
I have struct that store info about ARP packet and I need to save
I have a matrix type that is defined as: struct __transform_t { float m11,
In Matlab, there is something called struct, which allow the user to have a

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.