0
votes

I recently downloaded some code from matlab site to run it with octave. When I try to run a test.m file created by me that calls several functions from the downloaded source code files I receive:

octave:2> test

error: `verLessThan' undefined near line 101 column 8

error: called from:

error: /media/34GB/escola/efficientLBP/assignUserInputs.m at line 101, column 5

error: /media/34GB/escola/efficientLBP/efficientLBP.m at line 113, column 1

error: /media/34GB/escola/efficientLBP/test.m at line 5, column 7

checking the source file I found this code

    if isempty(funcParamsNames)
       isNoFuncParamsNames=true;
    else
       if verLessThan('matlab', '7.14') % again, old version do not support 'stable'. 
          funcParamsNames=unique(funcParamsNames); % This can lead to bugs :(
       else
          funcParamsNames=unique(funcParamsNames , 'stable');
       end%
       isNoFuncParamsNames=false;
    end

So I was wondering if there is a way to make octave to recognizance this function. Thanks for your time.

2
Octave's unique is like Matlab's unique(...,'sorted'), not like unique(...,'stable'), as you can see here.If you need a 'stable' for version Octave check this - Luis Mendo

2 Answers

0
votes

Octave seems to know an equivalent function unique, however, I see no option like Matlabs 'stable'.

Try unique and see what it does I guess?

if isempty(funcParamsNames)
   isNoFuncParamsNames=true;
else
   funcParamsNames=unique(funcParamsNames);       
   isNoFuncParamsNames=false;
end
0
votes

you can do unique with 'stable' yourself:

x = rand(1,10);x(5) = x(1);
% if you have 'stable'
y1 = unique(x,'stable');
% if you don't have 'stable'
[y2,ia] = unique(x);
[ia,idxs] = sort(ia);
y2 = y2(idxs);
% compare
isequal(y1,y2)