MATLAB Answers

call a input variable in a function

3 views (last 30 days)
mathru on 5 Apr 2021
Edited: mathru on 6 Apr 2021
I have created a model using pdetool command and kept the model under a function with name 'heat.m' as follows:
function A = heat (B,~)
Model = createpde('thermal','transient');
C = B/3.2;
E = C/5.;
Calling the above function within a for loop in separate script file. The for loop are as follows:
for j=1:length(t1)
D(j) =.....;
A = heat (D(j));
I am not getting any results. I understand that I am doing wrong while calling input variable B. At each iteation, the variable B will be replaced by D(j). How can I replace the input variable correctly?
mathru on 6 Apr 2021
Code is showing that it is running but not giving any output.
You are right. Output array is the problem. Trying to solve the problem.

Sign in to comment.

Answers (1)

DGM on 6 Apr 2021
The function definition indicates that A is the output array.
function A = heat (B,~)
But at least from what's shown here, A is never defined within the function scope, so nothing will be returned.

Community Treasure Hunt

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

Start Hunting!