How to create a matrix to contain possible combinations of 2 sets of 1D parameters
Afficher commentaires plus anciens
Hi,
I'd like to apply a function to all combinations of possible input parameters.
I just have 2 input parameters which are both vectors, so I'd like to create a matrix which effectively 'pairs' up my parameters.
Here's my code:
d=@(x,y) min(abs(x-y),1-abs(x-y));
x = 0:0.01:0.95;
y = 0:0.01:0.95;
Thank you!
N
Réponse acceptée
Plus de réponses (1)
result = bsxfun(d,x(:),y);
See also the NDGRID command.
Catégories
En savoir plus sur Data Types dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!