"Undefined function or variable '****'. The first assignment to a local variable determines its class."
Ältere Kommentare anzeigen
Hi all,
I'm using Coder to convert my code to C/C++.When I attempt to convert one of my functions just for practice, i started receiving errors. I was unsure how to define my inputs, so I used stops and discovered my input was a struct. The fields in that input I was able to define mostly as double(1x1) (determined by using stops again) as well as one of the fields being a struct as well. Now the error I get when I tryto build my code is
Undefined function or variable 'DopplerSpread'. The first assignment to a local variable determines its class.
What am I doing wrong? Do I need to define each function prior to using it in my code? Below is a sample of the line of code receiving that error.
DopplerSpread(path_ct) = FadeAll.Subpaths(path_ct).DopplerSpread;
Akzeptierte Antwort
Weitere Antworten (5)
Nam moon Kim
am 28 Sep. 2018
Bearbeitet: Nam moon Kim
am 28 Sep. 2018
I had a same problem. I think that is variable initiation problem.
in the matlab, if there is not variable, that's variable auto generation. however, in the stateflow, need a initiation.
in my case
*********************** error **********************
function ~
for i=1:len
temp(i) = i;
end
end
*********************** not error ******************
function ~
temp = zeros(len,1);
for i=1:len
temp(i) = i;
end
end
1 Kommentar
Nick
am 9 Jul. 2021
Do you know what to do if the variable that is giving me an error is an input to the function and is needed in an if statement?
Azza al-abri
am 2 Mär. 2016
0 Stimmen
how do you solve the issue i have the same problem
Sana Ben Hmouda
am 26 Jul. 2017
0 Stimmen
Hello everybody, The answer of Adam Kaas was very clear. Azza al-abri you need only to initialize the concerned variable at 0. (i.e if your variable is varia, so you put varia=0; before the loop starts)
Colin Shi
am 14 Aug. 2017
0 Stimmen
I did it in Sanna Ben said its right.
Aaditya Umasankar
am 24 Nov. 2021
0 Stimmen
Hello everybody, in mining truck shovel operation,the truck takes some load from escavator to crusher(unloads) and come back to escavator to load and again unloads it at crusher,and this process continues till shift time ends so how do we loop the entity generator(number of trucks,truck capacity are enity attributes)) with enity server(escavator and crusher) , for this which type of block shall be used to solve the problem(simevents)
2 Kommentare
SOUVIK BASAK
am 17 Jul. 2022
Please ask your doubt somewhere else. This is not related to discussion in this thread
ankit mishra
am 17 Sep. 2022
thanks aditya I got your analogy
Kategorien
Mehr zu Loops and Conditional Statements 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!