0
我正在閱讀一些MATLAB代碼,希望能夠提高我的知識水平。我不明白在第三行中使用下面的NaN
。爲什麼乘以NaN?
據我所知,它是一個N-N的矩陣,所以你爲什麼要通過NaN
多重?我也不明白ret_usdvec
被再次使用的行:ret_usdvec(sline(1,1):sline(1,2), :)... = tdata
。
int_cos = length(usedolchk);
int_obs = length(pricedatew);
ret_usdvec = num2cell(NaN * ones(int_cos * int_obs, 4));
sline = ones(1, 2);
int_count_max = 400000;
int_count = 0;
for t = 1:int_obs
if (int_count == 0)
QES_DB = SEdatabase(data_base, '', '');
end
sql_statement = ['select idchk, co_name, pdatew, ret from D_RAWRETS'];
cursor = exec(QES_DB, sql_statement);
cursor = fetch(cursor);
tdata = cursor.data;
sline(1, 2) = sline(1, 1) + length(tdata(:, 1)) - 1;
ret_usdvec(sline(1, 1):sline(1, 2), :)...
= tdata;
sline(1, 1) = sline(1, 2) + 1;
int_count = int_count + length(tdata(:, 1));
if (int_count >= int_count_max) || t == int_obs
close(QES_DB);clear QES_DB
int_count = 0;
end
end
順便說一句'NaN * ones(int_cos * int_obs,4)'與簡單的'NaN(int_cos * int_obs,4)'相同。噢,它不是N-N,而是N^2-by-4 – Dan