How do I use intersect(A,B,'legacy') correctly in my case?
1 view (last 30 days)
Show older comments
Hello MATLAB community, I am currently using a code from a scientific paper. The code was written with MATLAB 2012b, which means that the behaviour of 'intersect' has changed in newer releases. In order to run the code properly I have to replace all intersect(A,B) by intersect(A,B,'legacy'),according to https://de.mathworks.com/help/matlab/ref/intersect.html . Unfortunately I ran into a problem in this part of the code:
for i=1:N
gvarspecstartemp = [];
for j=1:cstypenum
eval(['starvec.vars{i,j} = intersect(gvarspec.',char(cskeys(i,1)),'.star,endovecfull{j});'])
gvarspecstartemp = [gvarspecstartemp, starvec.vars{i,j}];
end
eval(['gvarspec.',char(cskeys(i,1)),'.star = gvarspecstartemp;'])
end
I do not know how to replace the command in
eval(['starvec.vars{i,j} = intersect(gvarspec.',char(cskeys(i,1)),'.star,endovecfull{j});'])
I already tried these ways:
eval(['starvec.vars{i,j} = intersect(gvarspec.',char(cskeys(i,1)),'.star,endovecfull{j},'legacy');'])
eval(['starvec.vars{i,j} = intersect(gvarspec.',char(cskeys(i,1)),'.star,endovecfull{j},legacy);'])
The code can be found here http://www.sciencedirect.com/science/article/pii/S0014292115000197 in Appendix B.
I would really appreciate your help. Thank you.
2 Comments
Accepted Answer
the cyclist
on 8 Aug 2017
Edited: the cyclist
on 8 Aug 2017
I think you want
eval(['starvec.vars{i,j} = intersect(gvarspec.',char(cskeys(i,1)),'.star,endovecfull{j},''legacy'');'])
You need to double the single-quote characters, to tell MATLAB that they are part of the string, not delimiting the string.
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!