Hello forum.
I want to use an external matlab function to define a local heat transfer coefficient distribution.
If I use a very simple external function, everything works fine:
for example:
function value=alpha(z)
value = ones(size(z))*65000;
end
My function will load an object with the current data from a *mat - file and will read the data and give it back to COMSOL
something like that:
function out=AlphaZ1(z)
global pipe1;
path('V:\30_Numerik\COMSOL\Thermosyphon_2.0alpha\20130218001\classes',path)
strStoredVariableDataFileName = 'V:\30_Numerik\COMSOL\Thermosyphon_2.0alpha\20130218001\pipe1.mat';
load(strStoredVariableDataFileName)
value=pipe1.CondenserSection.GetAlphaZ(z');
out=round(value');
end
Unfortunately I always get an error message:
Attempted to access value(:,1); index out of bounds because size(value)=[0,0].
with no further details
If I save the z - vector to an mat-file and later try to call the function with this z-vector, it works properly and I get the correct heat transfer distribution.
Is there a way to analyse the error message and to find where it occurs? I already tried to catch all errors with a try-catch statement in MATLAB, but that does not help
Matthias
I want to use an external matlab function to define a local heat transfer coefficient distribution.
If I use a very simple external function, everything works fine:
for example:
function value=alpha(z)
value = ones(size(z))*65000;
end
My function will load an object with the current data from a *mat - file and will read the data and give it back to COMSOL
something like that:
function out=AlphaZ1(z)
global pipe1;
path('V:\30_Numerik\COMSOL\Thermosyphon_2.0alpha\20130218001\classes',path)
strStoredVariableDataFileName = 'V:\30_Numerik\COMSOL\Thermosyphon_2.0alpha\20130218001\pipe1.mat';
load(strStoredVariableDataFileName)
value=pipe1.CondenserSection.GetAlphaZ(z');
out=round(value');
end
Unfortunately I always get an error message:
Attempted to access value(:,1); index out of bounds because size(value)=[0,0].
with no further details
If I save the z - vector to an mat-file and later try to call the function with this z-vector, it works properly and I get the correct heat transfer distribution.
Is there a way to analyse the error message and to find where it occurs? I already tried to catch all errors with a try-catch statement in MATLAB, but that does not help
Matthias