Hmm i have just ran this snippet on the command window and it just worked fine, but the exact code is refusing to work in my function
Matlab does wired stuff
3 ビュー (過去 30 日間)
古いコメントを表示
This is part of a function that is doing what i called wired. The vector 'dim_set' in this snippet should expanded on both side depending on the value of the scalar 'const'. I have no idea while the result is wired. Pls help!
% expand dim_set by 1 or a const on each side
dim_set=[67.5:100.5];
const=20;
dim_set %befor
dim_set=floor(dim_set);
if(dim_set(1)>1)
dim_set=[dim_set(1)-const:dim_set(1),dim_set];
end
dim_set=[dim_set,dim_set(end):dim_set(end)+const];
% See befoer and after values of dim_set to see this
dim_set %after
6 件のコメント
採用された回答
Paulo Silva
2011 年 2 月 21 日
dim_set=67.5:1:100.5
const=20;
dim_set %before
dim_set=floor(dim_set); %have no clue what's the purpose of this line
dim_set=[dim_set(1)-const:dim_set(1)-1 dim_set]; %expand left
dim_set=[dim_set dim_set(end)+1:dim_set(end)+const]; %expand right
% See before and after values of dim_set to see this
dim_set %after
5 件のコメント
Paulo Silva
2011 年 2 月 21 日
You were correct, now that I know what your function does I came to the conclusion that the borders are irrelevant but there's no need to waste a little more memory with duplicated values.
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!