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

  • Home
  • SEARCH
  • 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 8916103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:08:59+00:00 2026-06-15T05:08:59+00:00

I have a MATLAB variable that is a 3×6 cell array. One of the

  • 0

I have a MATLAB variable that is a 3×6 cell array. One of the columns of the cell array holds at most 150-200 small RGB images, like 16×20 pixel size (again, at most). The rest of the columns are:

  • an equal number of labels that are strings of a 3 or 4 characters,

  • an image mask, which is about 350×200

  • 3 integers

For some reason saving this object is taking a very long time, or at least for the size of the object. It has already been 10 minutes(which isn’t too bad, but I plan on expanding the size of the object to hold several thousand of those small images) and MATLAB doesn’t seem to be making any progress. In fact, when I open the containing directory of the variable, its size is cycling between 0 bytes to about 120kB. (i.e. it will increase to 120 in steps of 30 or 40 kB, then restart).

Is this normal behavior? Do MATLAB variables always take so long to save? What’s going on here?

Mistake: I’m saving AllData, not my SVM variable. AllData has the same data as the SVM keeper, less the actual SVM itself and one integer.

What particular points of the code would be helpful to show for solving this? The code itself is a few hundred lines and broken up in several functions. What would be important to consider to troubleshoot this? When the variable is created? when it’s saved? The way I create the smaller images?

Hate to be the noob who takes a picture of their desktop. but the machine I’m working has problems taking screenshots. Anyway, here it is

Alldata/curdata are just subsets of the 3×7 array… actually it’s a 3×8, but the last is just an int.

Interesting side point: I interrupted the saving process and the variable seemed to save just fine. I trained a new svm on the saved data and it works just fine. I’d like to not do that in the future though.
Workspace contents

Using whos:

Name                               Size                 Bytes  Class      Attributes

AllData                            3x6                 473300  cell                 
Image                            240x352x3             253440  uint8                
RESTOREDEFAULTPATH_EXECUTED        1x1                      1  logical              
SVMKeeper                          3x8                2355638  cell                 
ans                                3x6                 892410  cell                 
curData                            3x6                 473300  cell                 
dirpath                            1x67                   134  char                 
im                               240x352x3            1013760  single               
s                                  1x1                 892586  struct   

Updates:
1.Does this always happen, or did you only do it once?

-It always happens

2.Does it take the same time when you save it to a different (local) drive?

-I will investigate this more when I get back to that computer

3.How long does it take to save a 500kb matrix to that folder?

-Almost instantaneous

4.And as asked above, what is the function call that you use?

-Code added below

(Image is a rgb image)

MaskedImage(:,:,1)=Image(:,:,1).*Mask;
MaskedImage(:,:,2)=Image(:,:,2).*Mask;
MaskedImage(:,:,3)=Image(:,:,3).*Mask;
MaskedImage=im2single(MaskedImage);
....


(I use some method to create a bounding box around my 16x20 image)
(this is in a loop of that occurs about 100-200 times)

 Misfire=input('is this a misfire?','s');
 if (strcmpi(Misfire,'yes'))
    curImageReal=MaskedImage(j:j+Ybound,i:i+Xbound,:);
    Training{curTrainingIndex}=curImageReal;  %Training is a cell array of images
    Labels{curTrainingIndex}='ncr';
    curTrainingIndex=curTrainingIndex+1;
 end


  (the loop ends)...


SaveAndUpdate=input('Would you like to save this data?(say yes,definitely)','s');
undecided=1;
while(undecided)
if(strcmpi(SaveAndUpdate,'yes,definitely'))
   AllData{curSVM,4}=Training;
   AllData{curSVM,5}=Labels;
   save(strcat(dirpath,'/',TrainingName),'AllData'); <---STUCK HERE
   undecided=0;
else
   DontSave=input('Im not going to save. Say YESNOSAVE to NOT SAVE','s')
   if(strcmpi(DontSave,'yesnosave'))
      undecided=0;
   else
      SaveAndUpdate=input('So... save? (say yes,definitely)','s');
   end
end
end
  • 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-15T05:09:00+00:00Added an answer on June 15, 2026 at 5:09 am

    This isn’t a great answer, but it seems that the problem was that I was saving the version of my image after I had converted it to a single. I don’t know why this would cause such a dramatic slowdown (after removing this line of code it worked instantly) so if someone could edit my answer to shed more light on the situation, that would be appreciated.

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

Sidebar

Related Questions

I have a Matlab function that creates a cell array with matrixes inside. It
Does MATLAB have a function/operator that indicates the type of a variable (similar to
I have a MATLAB class that contains a method that employs a persistent variable.
I have a Matlab program that generates a list x = 6.1692 8.1863 5.8092
I have a Matlab program that is running longer than I'd like it to.
I have a matlab script, lets call it master.m, that loads a file called
I'd like to have a MATLAB array fill a column with numbers in increments
I have a matlab .mat file that stores a bunch of variables. How do
I have complex code blocks, in a Matlab script, that act on large, non-sparse
It seems I have a MATLAB name clash with one of my variables called

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.