When upgrading from MATLAB 7.5 (R2007b) to MATLAB 7.8 (R2009a) I have detected a change in the output from the function DBSTACK.
The output from DBSTACK is different between the releases when I use EVALIN to evaluate a function from its caller function. I can find no information about this in the documentation or release nortes.
The two attached files show this behavior.
When executing [a,b] = dbstackTest MATLAB 7.5, a is returned as a 4×1 struct array with fields 'file', 'name' and 'line' and b is 1. The struct array a has the elements
>> a(1)
ans =
file: 'dbstackWrapper.m' name: 'dbstackWrapper' line: 3
>> a(2)
ans =
file: 'dbstackTest.m' name: 'dbstackTest' line: 3
>> a(3)
ans =
file: 'dbstackTest.m' name: 'dbstackSub' line: 10
>> a(4)
ans =
file: 'dbstackTest.m' name: 'dbstackTest' line: 3
For the same function evaluated in MATLAB 7.8, a is returned as a 3×1 struct and b is 1. Now the struct array a has the elements
>> a(1)
ans =
file: 'dbstackWrapper.m' name: 'dbstackWrapper' line: 3
>> a(2)
ans =
file: 'dbstackTest.m' name: 'dbstackSub' line: 10
>> a(3)
ans =
file: 'dbstackTest.m' name: 'dbstackTest' line: 3
Thus, the output in 7.5 has one more element in the array.
Best Answer