Calling a variable before it is created?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello all, I am calling a func (on line 10) it is using a variable that is defined in a set of lines(from line 100-110). In other words,i want to process a set of lines FIRST (which are present in middle of code and then continue the usual code). How can i do that? thanks alot
0 Kommentare
Antworten (1)
Image Analyst
am 15 Nov. 2015
Copy those set of lines from down below in your script or function to before line 10. If you want, you can make those set of lines into their own function and just call that function twice, once before line 10, and once inside the function that needs them.
5 Kommentare
Image Analyst
am 15 Nov. 2015
Why do you think it should know, in line 1 of ts_cnvr(), how many rows are in data when you did not pass it in to ts_cnvr()? You need to pass it in. In func_retrieve(), at line line 92, you call ts_cnvr() but did not pass it data. You need to define data somewhere in func_retrieve.m before line 92 so that you can then pass it to ts_cnvr like this
In func_retrieve.m file
% Some code .... then:
data = ...... % Somehow define or get data
% at line 92
output = ts_cnvr(data);
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements 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!