I've got the following problem. I run a simulation which extract an array called Iabc to workspace. I use then a function which takes as an input this array and have as outputs the fault location and an error. I would like to use a matlab function block inside simulink that will run the function and will show the fault location and the error in two displays. However, the function to work has to wait simulation to finish in order to get this array to work. I dont know how to do that. Any ideas?
The code of the function is:
function[location,er]=fault(Iabc)
Iaa=Iabc(:,1);
Ibb=Iabc(:,2);
Icc=Iabc(:,3);
.
.
.
location=((2.89*10^5)*td*10^-6)/2;
actual_fault=get_param('two_remotes/Distributed Parameters Line','Length');
k=str2num(actual_fault);
er=abs(location-k);
end
I want to work like that, to take as input the array.