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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:55:50+00:00 2026-05-27T07:55:50+00:00

The following loop reads data from excel into matlab with the use of actxserver.

  • 0

The following loop reads data from excel into matlab with the use of actxserver. The loop wont complete due to an error which states that the data from excel is too great. I find this hard to believe as there are 75 excel sheets each with approximately 14000 rows and 21 columns so the dataset isn’t extremely massive. Therefore, I’m not sure if its the loop which is causing the problem or the dataset is too big.

The script is as follows:

clear all
%obtain the name of each of the folders under investigation
path='F:\University\CEH Lancaster\Project\Practice'; 
folder = path; 
dirListing = dir(folder); 
dirListing=dirListing(3:end);%first 2 are just pointers
for i=1:length(dirListing);
    Folder_Name{i}=dirListing(i,1).name;
    f{i} = fullfile(path, dirListing(i,1).name);%obtain the name of each folder
    files{i}=dir(fullfile(f{i},'*.xls'));%find the .xls files
    for j=1:length(files{1,i});
        File_Name{1,i}{j,1}=files{1,i}(j,1).name;%find the name of each .xls file in each folder
    end
end
%manually obtain the name of the required worksheets
Name_workbook={'Data1', 'Data2', 'Data3', 'Data4'};
%read data in from excel
excel = actxserver('Excel.Application');
excel.Visible=0;
for i=1:length(File_Name);
    a(i)=length(File_Name{1,i});
    for j=1:a(i);
        file{1,i}{j,1}=excel.Workbooks.Open(fullfile(path,Folder_Name{1,i},File_Name{1,i}{j,1}));
        sheet1{1,i}{j,1}=excel.Worksheets.get('Item', Name_workbook(1,i));
        MyRange{1,i}{j,1}=sheet1{1,i}{j,1}.UsedRange; 
        MyData{1,i}{j,1}=MyRange{1,i}{j,1}.Value;        
    end
end

Does anyone have an opinion on what I should try next?

  • 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-27T07:55:51+00:00Added an answer on May 27, 2026 at 7:55 am

    Should you be closing the workbooks after you read the data? If you are opening files and not closing them then excel may have too many workbooks open at the same time.

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

Sidebar

Related Questions

I'm trying to accomplish the following: Have a thread that reads data from a
I have the following loop inside an function init(); which is executed onload, I
I'm getting odd behavior (it generates only missing values) from the following loop -
I want to do following: Make Oracle stored procedure for read all data from
I'm trying to select data from the database and I have the following code
I'm getting the following error: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
I had used JExcel API for importing Data's from Excel,for using JExcel , I
when the following code is compiled it goes into an infinite loop: int main()
I'm dealing with a legacy application written in VB6 which reads in Excel spreadsheets
I want to read data to a list from database. I tried the following

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.