How to create variables in the command prompt space using a function
Ältere Kommentare anzeigen
I have a problem with passing a value of a variable (say X)in one function (function A) to another function (function B), because i can't pass the particular function arguments of the first function(A) inside the function B. So what I am trying to do is this. I can get the values of that variable(X)to the command prompt. Then I am trying to pass those values to the second function(B) as an argument. It's hard to put the real problem in here. I will give an example the following is my function A.
function [X] = funcA (inputsToA)
X; //this is the required variable to be passed to function B
end
my second function is as follows
function [outB] = funcB (inputsToB)
.
.
X = funcA (inputsToA) //i am trying to get X here, BUT 'inputsToA' has to be //generated in the function and it's not possible due to some reasons.
end
So what I am trying to do is this. First get the value of X to the command prompt simply as follows (by removing the semicolon at X)
function [X] = funcA (inputsToA)
X //remove the semicolon
end
and then try to get that value passed to the function B as follows.
function [outB] = funcB (inputsToB,X) //trying to get the value X end
So please be kind enough to show me a way to get this done...and apologize for the incompleteness of the problem. And I am new to MatLab programming. Thanks .
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Numeric Solvers finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!