Two identical commands take different times to run?
Mostra commenti meno recenti
I am running this function inside a bigger script:

K11 and K12 are just the same Matrix at start. I have two questions now:
- Why is line 11 taking much more than 9? It is the exact same command
- Why removing columns is much easier than removing rows?
Risposta accettata
Più risposte (1)
Marta Salas
il 5 Mar 2014
0 voti
When you create a 2D array, you need to reference each element to its memory address. As a result, for a 2D array, you need to allocate MxN elements in memory (where M is the number of rows and N of columns). Since memory is a linear object, you need to choose how you organize these elements. You have two options “Row major order” or “Column major order”. Matlab choses the Column major order option.
Categorie
Scopri di più su Performance and Memory in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
