Info
此问题已关闭。 请重新打开它进行编辑或回答。
i wanna save the tau and h values in each iteration for which y values are calculated
1 次查看(过去 30 天)
显示 更早的评论
>> tau = 6:100; h = [2,3,4];
>> X = bsxfun(@rdivide,tau,h(:));
>> Y = X(rem(X,1)==0);
thank you
0 个评论
回答(1 个)
Geoff Hayes
2015-3-22
Arunachalam - try using find to determine those rows and columns of X whose remainder (when divided by one) is zero. Something like
[rowIdcs, colIdcs] = find(rem(X,1)==0);
The rowIdcs would tell you the h and the colIdcs would tell you the tau. For example, if I run the above line, the first handful of row indices and column indices are
>> rowIdcs(1:5)
ans =
1
2
1
3
2
colIdcs(1:5)
ans =
1
1
3
3
4
The first two elements of colIdcs are 1 which corresponds to tau(1) (i.e. 6). The first two elements of rowIdcs are 1 and 2 which corresponds to 2 and 3 respectively. And this makes sense since 6 is evenly divisible by 2 and 3 but not by 4.
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!