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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:50:11+00:00 2026-06-17T19:50:11+00:00

I am working on some Matlab homework and I was having issues conceptualizing the

  • 0

I am working on some Matlab homework and I was having issues conceptualizing the way that it addresses matrices. In Matlab the matrix is address in d(row,col) format.

I have been programming for a while and have always tended to think of a one dimensional array as a horizontal structure with a second dimension extending out from below.

Which of these is a “more correct” way of thinking about an array data structure from the computer’s point of view

  • 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-17T19:50:13+00:00Added an answer on June 17, 2026 at 7:50 pm

    Good question +1.

    Purely from a Matlab programming perspective, it is best to think of a matrix as a sequence of column vectors. Why? Because this is how Matlab allocates them to your computers memory. That is, two sequential elements in any given column of a matrix will be allocated next to each other in memory. This is sometimes referred to as “column-major order”, and is used in languages such as Fortran, R, and Julia. The opposite is, unsurprisingly, called “row-major order”, and is used in C and Python.

    The implication of this is that Matlab will be much faster at performing operations on the columns of a matrix than on the rows. @angainor provided a great answer to a question of mine a few months ago that demonstrates this fact. Based on @angainor’s insight, here is a useful speed test to run:

    M = 1000; %# Number of iterations over each method
    T = 1000; %# Number of rows
    N = 1000; %# Number of columns
    
    X = randn(T, N); %# Random matrix
    
    %# Loop over the rows of a matrix and perform a sum operation on each row vector
    tic
    for m = 1:M
        for t = 1:T
            sum(X(t, :));
        end
    end
    toc
    
    %# Loop over the columns of a matrix and perform a sum operation on each column vector
    tic
    for m = 1:M
        for n = 1:N
            sum(X(:, n));
        end
    end
    toc
    

    On my machine, the outcome of the test is:

    Elapsed time is 9.371870 seconds. %# Looping over rows
    Elapsed time is 1.943970 seconds. %# Looping over columns
    

    In other words, operations performed on columns are almost 5 times faster than operations performed on rows!

    From a mathematical perspective I don’t trust myself to give a good answer. You could probably get some great insights from math.stackexchange.

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

Sidebar

Related Questions

I am working with some matlab code that processes data (in a Kalman Filter)
I'm working some code that inserts csv rows into an SQLite database using Python.
Working on some tweaks for a build script, I noticed that the output from
When working on some Javascript for a web application, I noticed that I had
I'm working with transferring some Matlab code to Python. I'm relatively new to Python
Is there some way that I can get matplotlib to block code execution pending
I'm working on a Matlab code that takes video frames, puts them inside a
I am working on some fourier transform code in matlab, and have come across
I have been working with some friends to convert a Matlab Genetic Algorithm to
I have some working code that does amplitude modulation and plots it. However I'm

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.