MATLAB: How to access the outputs seperately

matlab functionneural network

suppose i have a function f(x) =@(t) sim(net,t'). It has 2 outputs how can i seperate them? example: f(1) = [1,2], f(2) =[3,4], f(3) = [5,6] …. then how can i call only 1st outputs of the above results (i.e, {1,3,5 etc}) i hope that i was able to explain my problem, looking forward for an answer.

Best Answer

  • Assign them to a variable and index them.
    Or if you really want to do it in an expression, define an anonymous function such as
    Col1 = @(V) V(:,1);
    and then you can code things like
    f = @(t) Col1(sim(net,t'));