var_listindices.m: fix for Octave
parent
6bb4ec4d9b
commit
667d5ac262
|
@ -30,8 +30,22 @@ function [i_var,nvar] = varlist_indices(sublist,list)
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
% In Octave, ismember() doesn't operate on character arrays
|
||||||
[check,i_var] = ismember(sublist,list,'rows');
|
if ~exist('OCTAVE_VERSION')
|
||||||
|
[check,i_var] = ismember(sublist,list,'rows');
|
||||||
|
else
|
||||||
|
check = [];
|
||||||
|
i_var = [];
|
||||||
|
for i = 1:rows(sublist)
|
||||||
|
tmp = strmatch(sublist(i,:), list, 'exact');
|
||||||
|
if isempty(tmp)
|
||||||
|
check = [ check; 0 ];
|
||||||
|
else
|
||||||
|
check = [ check; 1 ];
|
||||||
|
i_var = [ i_var; tmp ];
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
nvar = length(i_var);
|
nvar = length(i_var);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue