need shrter code
1 回表示 (過去 30 日間)
古いコメントを表示
hi,
can anybody make these code shorter and faster?
Nofusers=17856;
k1 = 1;
f1 = fopen('d:\matlab11\bin\flixster_time\ratings_tf\len_flix1.txt');
c = fscanf(f1,'%d');
fclose(f1)
ini = 1;
f = fopen('d:\matlab11\bin\flixster_time\ratings_tf\flix_fin.txt');
cod = fscanf(f,'%d');
for i = 1:17856
k = 1;
for j = ini:c(i)+ini-1
celcod{i}(k) = cod(j);
k = k+1;
end;
ini = ini + c(i);
end
thanks
1 件のコメント
Jan
2012 年 5 月 6 日
This is your 109'th question in this forum. I expect that you know how to format the code.
Do you have a good reason not to care about the readability of your question?
採用された回答
Jan
2012 年 5 月 6 日
...
celcod = cell(1, 17856); % Pre-allocate!
ini = 1;
for i = 1:17856
celcod{i} = cod(ini:c(i)+ini-1);
ini = ini + c(i);
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で NaNs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!