Error using variable in a function with trial version
Ältere Kommentare anzeigen
Hello,
I have a problem using my function Selection Sept. It told me that i use date as a function or a command but i don't know where. Why can't I name it in my script, use it in my function and then use it in my script again ? It worked on my friend computer who don't have the trial version but i do and on mine in doesn't work...
Thank you very much
Akzeptierte Antwort
Weitere Antworten (1)
dpb
am 13 Mai 2017
function [matrice] = SelectionSept (matrice)
for i = length(date):-1:1;
...
date isn't defined in your function excepting as the builtin Matlab function
>> which date
C:\ML_R2014b\toolbox\matlab\timefun\date.m
because functions have their own context and the array date you created in the script isn't passed to the function.
It would behoove you to not use builtin function names in general; confusion reigns when alias something this way.
While I do NOT recommend it; the code above would function if the sundtion were defined to use date as the argument; then it would become associated with the A array passed internally. BUT, do NOT do this; use some other variable name other than DATE!!!
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!