Calling same function shows index in position 1 exceed array bounds even having same input matrix size?

3 Ansichten (letzte 30 Tage)
Hi,
I am getting error in calling the same function with different matrix (of same size).
The function is: All input matrix is of same length.
[rate1] = rate(device,BandWidth,Tx,Power1,fading1,No_power);
[rate2] = rate(device,BandWidth,Tx,Power2,fading2,No_power);
  • Note - If i change function name to rate1 and rate2. It not showing error. Donot Why??????????

Akzeptierte Antwort

Voss
Voss am 31 Dez. 2021
If you do this:
[rate] = rate(device,BandWidth,Tx,Power1,fading1,No_power);
Then rate is now a variable (the output from the function rate()). And the rate() function can no longer be called by saying rate(whatever). 'whatever' is treated like indexes into the variable rate rather than like inputs to the function rate(). So you may get an error the next time you use rate.
Changing the output variable to rate1 fixes it because the function rate() is not replaced in the workspace by the variable rate.
  6 Kommentare
Walter Roberson
Walter Roberson am 31 Dez. 2021
Bearbeitet: Walter Roberson am 31 Dez. 2021
restoredefaultpath
rehash toolboxcache
Do the above commands once .
If the problem with getExtendedErrorCallback goes away, then there is something on your MATLAB path that is interfering with normal processing.
SANDEEP SINGH RANA
SANDEEP SINGH RANA am 31 Dez. 2021
This problem got resolved when i make a new folder, write all the codes in that folder.
Thanks a lot for the help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by