ismember legacy flag with older Matlab
13 vues (au cours des 30 derniers jours)
If I use the legacy flag of ismember function in Matlab prior to 2012b like this
if ismember(A,B,'rows','legacy') do something... end
I get too many input arguments -error.
I'd like my code to work on both, earlier and newer Matlabs so how can omit the legacy flag if older matlab is used. I really don't want to make separate if-clauses in case of older and newer versions because there are so many of them.
Friedrich le 25 Août 2014
an IF clause is the only way here.
You could write your own small helper function which calls ismember and deals with the versions. So something like (haven't actually tried it but something like this should do it):
function [Lia,Locb] = myismember(A,B,flag)
if flag_was_provided AND MATLAB_version_is_smaller_than_8
[Lia,Locb] = ismember(A,B)
[Lia,Locb] = ismember(A,B,flag)