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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:53:46+00:00 2026-06-17T09:53:46+00:00

I have two big matrices in two files, A (21,000 x 80,000) and B(3,000

  • 0

I have two big matrices in two files, A (21,000 x 80,000) and B(3,000 x 80,000) that I want to multiply:

C = A*B_transposed

Currently I have the following script:

A = dlmread('fileA')
B = dlmread('fileB')
C = A*(B')
dlmwrite('result', C)
exit

However, reading the matrices (first two lines) takes very long and Matlab (after each dlmread) proceeds to print these matrices. Do you know how to disable this printing and make the process faster?

  • 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-17T09:53:47+00:00Added an answer on June 17, 2026 at 9:53 am

    To suppress printing you merely need to put a semicolon after each line:

    A = dlmread('fileA');
    B = dlmread('fileB');
    dlmwrite('result', A * B');
    

    One way to speed up the read is to tell Matlab what delimiter you are using, so that it doesn’t need to be inferred. For example, if the file is tab delimited you could use

    A = dlmread('fileA','\t');
    

    or if it’s comma delimited you could use:

    A = dlmread('fileA',',');
    

    Other than that, you could consider using a different file format. Where are the files generated? If they’re generated by another Matlab process, then you could save them in Matlab’s binary format, which is accessed using load and save:

    A = [1 2; 3 4];
    save('file.mat','A');
    clear A;
    load('file.mat','A');
    

    For a quick benchmark, I wrote the following matrix to two files:

    >> A = [1 2 3; 4 5 6; 7 8 9];
    >> dlmwrite('test.txt',A);
    >> save('test.mat','A');
    

    I then ran two benchmarks:

    >> tic; for i=1:1000; dlmread('test.txt',','); end; toc
    Elapsed time is 0.506136 seconds.
    >> tic; for i=1:1000; load('test.mat','A'); end; toc
    Elapsed time is 0.260381 seconds.
    

    Here the version using load came in at half the time of the dlmread version. You could do your own benchmarking for matrices of the appropriate size and see what works best for you.

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

Sidebar

Related Questions

Have two folders with approx. 150 java property files. In a shell script, how
I have two files at the same location but the big one, when is
I have to multiply two big numbers - saved as string - any hint
I have two big text Files each having more than 10 Million lines. How
I have two divs that I want to appear on top of each other.
I have two very big functions, a and b , which are currently in
I have a question. My case study is that I have two big SQLite
I have the two big and small list. I want to know which of
I have a two big files with Start and End positions and two sample
I have two hashes, one big and one small. All of the smaller hash's

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.