Execution of script nchoosek as a function is not supported

I am trying to use the nchoosek function and I get this error "Execution of script nchoosek as a function is not supported".
I am entering:
b = nchoosek(5,4)
Thanks for any help!

1 commentaire

Please don't use an answer to make a comment and a followup to the answer you got.

Connectez-vous pour commenter.

Réponses (1)

Bruno Luong
Bruno Luong le 26 Avr 2022
Modifié(e) : Bruno Luong le 26 Avr 2022
Please do that
which nchoosek
/MATLAB/toolbox/matlab/specfun/nchoosek.m
you must find somewhere similar to the above or this
C:\Program Files\MATLAB\R2022a\toolbox\matlab\specfun\nchoosek.m
You probably shadow the stock function (get different result).

3 commentaires

Thanks for the help Bruno.
When I enter "which nchoosek" I get the current file path.
When I go to this folder:/MATLAB/toolbox/matlab/specfun/nchoosek.m I see the nchoosek function.
What do I need to do to get it to work?
@David Rann when you edit it
edit('/MATLAB/toolbox/matlab/specfun/nchoosek.m')
can you see the first line with "function c = nchoosek(v,k)"
If not it looks like the original file is corrupted.
"When I enter "which nchoosek" I get the current file path."
That does not sound good: do you have a script named NCHOOSEK ? What is the current path?
Please show us what this command prints:
which nchoosek -all

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Coder dans Centre d'aide et File Exchange

Produits

Version

R2021b

Tags

Question posée :

le 26 Avr 2022

Commenté :

le 27 Avr 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by