Matlab does wired stuff
古いコメントを表示
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 件のコメント
bethel o
2011 年 2 月 21 日
Sean de Wolski
2011 年 2 月 21 日
Do you have a question?
Andreas Goser
2011 年 2 月 21 日
I can't resist: Is it wired ot weird?
bethel o
2011 年 2 月 21 日
bethel o
2011 年 2 月 21 日
Andreas Goser
2011 年 2 月 21 日
I noticed that :-) - can't edit the comments
採用された回答
その他の回答 (1 件)
bethel o
2011 年 2 月 21 日
9 件のコメント
Paulo Silva
2011 年 2 月 21 日
You are mixing the function and the function call in the same code and you don't explain exactly the purpose of your function.
Are you trying to see if dim_set is present inside memb?
bethel o
2011 年 2 月 21 日
Paulo Silva
2011 年 2 月 21 日
just use the matlab ismember function
doc ismember
Paulo Silva
2011 年 2 月 21 日
or even better
tf=isempty(dim_set(dim_set==memb))
Paulo Silva
2011 年 2 月 21 日
I forget the negation ~, this way should work
tf=~isempty(dim_set(dim_set==memb))
bethel o
2011 年 2 月 21 日
Paulo Silva
2011 年 2 月 21 日
Seem to be working fine here with all the changes I suggested
bethel o
2011 年 2 月 21 日
bethel o
2011 年 2 月 21 日
カテゴリ
ヘルプ センター および File Exchange で Code Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!