Can any one please tell me that why the loop is running nXn times?

1 vue (au cours des 30 derniers jours)
Gaurav Sharma
Gaurav Sharma le 28 Nov 2018
Commenté : Gaurav Sharma le 28 Nov 2018
I am trying to run the code but instead of runnong for single loop, it is actually running for nXn times. Can any one pls help me this?
Code.m is that function.
Secondly, Why my all speakers are matching with only speaker 1??
  3 commentaires
Jan
Jan le 28 Nov 2018
"Why my all speakers are matching with only speaker 1" is hard to answer, when it is not explained what "matching" and "speaker" means. Which one is the "single for loop" and why do you assume that is runs "nXn times" - by the way: what does this mean exactly?
Gaurav Sharma
Gaurav Sharma le 28 Nov 2018
when i am trying to run it , for eg. for n=2, the loop runs for 2x2 times, i.e. output will be :
"Speaker 1 matches with speaker 1
Speaker 2 matches with speaker 1
Speaker 1 matches with speaker 1
Speaker 2 matches with speaker 1".

Connectez-vous pour commenter.

Réponse acceptée

David Goodmanson
David Goodmanson le 28 Nov 2018
Hi Gaurav,
You are only matching up to speaker 1 because in the 'test' function, variable x might equal zero but if not, it's hardwired to be x = 1.
You are gettting the repeated output because in 'code' you call the 'test' function twice in a for loop.

Plus de réponses (0)

Catégories

En savoir plus sur Quadratic Programming and Cone Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by