Again, a note-taking which will be updated as I see fit. Disclaimer: this is a short writing, concise, with less to no explanation.
To sort a matrix based on a particular column(s). Use [c1 c2] to sort based on two (or more) columns.
B = sortrows(A,column)
data= sortrows(rawdata,[1 2]);
To read and convert dates from csv or txt files to date matrix. For example, if the date in your data is written as ‘19991205’ for 5th Dec 1999, then we need to convert it to string, and then to date, as follows.
dates = datenum(num2str(the_record(:,1)),'yyyymmdd');
if you works with other file formats, e.g. Ms.Excel, then this might be useful. The following will give you sheet names, and then read the data.
[~,sht]=xlsfinfo([FD fname]);
FD = your folder path
fname = your file name..
for i = 1:n
data{i}=xlsread([FD fname],sht{i},range);
end
If you have an $latex N$ long vector, then you wanna sum every $latex n$ rows in the vector, then you can try this one.
sum(reshape(A,n,nx))
with nx = N/n
to be continued….