How to read value of the variable from a ode45 function file from script file?

I have the script file and function file.
The script file use ode45 to solve differential equation from function file.

close all;
[z,x,B] = ode45(@Fdiff,[0:5],1);


function [dxdz,B] = Fdiff(z,x)
A = 5 + 10;
B = x(1) * A;
dxdz(1) = x(1) + B;
dxdz = dxdz';

In the script file (top), I want to read the value of B in the function file as well.
So I add B to the output of the function in Fdiff.
But it does not work, the value of B read as [].

How to read value of B in the function file from script file?

GNU Octave, version 7.1.0 (Flatpak)
Operating System: openSUSE Tumbleweed 20220428 (Linux)
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.2
Kernel Version: 5.17.4-1-default (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 4600H with Radeon Graphics
Memory: 7.1 GiB of RAM
Graphics Processor: AMD RENOIR

Your function has only two outputs but you’re calling it with three outputs, so the third one B will be set to the empty vector. Change those lines to match each other. Edit: when you pass it to the ode functions it’ll call the differential function with only one output argument typically. You may want to wrap it with an anonymous function @(x) to to get you the behavior you want. See help ode45 for output sequence.

The help ode45 example in the online manual XREFode45 (GNU Octave (version 7.1.0)).