Code covered by the BSD License  

Highlights from
The speed of reading and writing matrix by function

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 1.73 KB File ID: #25845

The speed of reading and writing matrix by function

by Su Dongcai

 

15 Nov 2009

A simple demonstration on the speed of reading and writing matrix by function

| Watch this File

File Information
Description

function check_rwSpeed(data, N_iters)
%effect: a simple demonstration on the running time of %reading/writing matrix by matlab functions
%Example:
%1. check the speed of reading matrix:
%N=100000;
%N_iters = 100;
%data = rand(1, N);
%check_rwSpeed(data, N_iters);

%2. check the speed of writting matrix:
%At first you should uncomment the 2 commented lines begin with the symbol
% "%#", then do the same thing as following:
%N=100000;
%N_iters = 1000;
%data = rand(1, N);
%check_rwSpeed(data, N_iters);

% Purely reading:
% It will take no time to complete "check_readingData" no matter how large size the "data" is.
%
% Reading and Writing:
% if you umcommend the 2 commended lines begin with "%#", you will find:
% 1. The running time of "check_readingData" increase dramatically when the size of data increase.
% 2. data(end) never change.
%
% Conclusion:
% Reading a matrix M in a function is straightforward, it just access the pointer of the matrix directly and take no time to complete.
% Writting a matrix M in a function is more complicated, first, it will atomatically create a copy of M called M_buffer, then it will changed the
% corresponding element in M_buffer rather than in M.

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
function Su Dongcai 16 Nov 2009 09:37:42
read Su Dongcai 16 Nov 2009 09:37:42
write Su Dongcai 16 Nov 2009 09:37:42
matrix Su Dongcai 16 Nov 2009 09:37:42
speed Su Dongcai 16 Nov 2009 09:37:42
running time Su Dongcai 16 Nov 2009 09:37:42
data import Su Dongcai 16 Nov 2009 09:37:42

Contact us at files@mathworks.com