Skip to Main Content
Programming in MATLAB ®: A Problem-Solving Approach by Pearson
book

Programming in MATLAB ®: A Problem-Solving Approach by Pearson

by Ram N. Patel, Ankush Mittal
May 2024
Intermediate to advanced content levelIntermediate to advanced
433 pages
13h 7m
English
Pearson India
Content preview from Programming in MATLAB ®: A Problem-Solving Approach by Pearson
214
Ñ
Using Memory Efficiently
load a1; load b1;
c1= a1*b1;
clear b1; clear a1;
load a2; load b3;
c1 = c1+a2*b3;
clear a2 b3;
save c1 c1; clear c1;
% The code for computing c2,c3 & c4 is same
% as c1. It is possible to optimize a bit
% here by not clearing say a2 in the last
% step of c1 computation and then use it
It can be seen that by using “load” and “save” commands, the maximum memory used by
split_mat.m is less than the memory required to compute C = A*B.
Time for Practice 7.5
If X is a matrix, MATLAB function sort(X) sorts each column of X in ascending order. For
example,
>> X = [3 7 5; 0 4 2]
X =
3 7 5
0 4 2
>> Y = sort(X)
Y =
0 4 2
3 7 5
When ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Applied Numerical Methods Using MATLAB, 2nd Edition

Applied Numerical Methods Using MATLAB, 2nd Edition

Won Y. Yang, Wenwu Cao, Jaekwon Kim, Kyung W. Park, Ho-Hyun Park, Jingon Joung, Jong-Suk Ro, Han L. Lee, Cheol-Ho Hong, Taeho Im
MATLAB Recipes: A Problem-Solution Approach

MATLAB Recipes: A Problem-Solution Approach

Michael Paluszek, Stephanie Thomas
Practical MATLAB Deep Learning: A Projects-Based Approach

Practical MATLAB Deep Learning: A Projects-Based Approach

Michael Paluszek, Stephanie Thomas, Eric Ham

Publisher Resources

ISBN: 9781306983440Publisher Website