The sign "~" is not backwards compatible?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am using MATLAB 2010b and I created a GUI in GUIDE. The code generated by Matlab contained a lot of input variables for GUI objects like "hObject" and "eventdata".
The tool which shows you the errors/warnings concerning your code gave messages like: "Input argument 'hObject' might be unused. If this is OK, consider replacing it by ~" I could just click 'Fix' and it did by itself.
I clicked Fix on these error messages, therefore in place of quite a lof of unused input arguments there are tildes (~) in my code now in large amounts, hundreds of them. The problem is that I gave my code to another person, who is using Matlab 2008, and it doesn't recognize the ~ sign. I tried to delete them all, but of course then it returns with "not enough input arguments"
Is there any automatic way to fix this issue? It would be really painful to write back all the input arguments manually and would take hours.
Thank you in advance, László
0 Kommentare
Akzeptierte Antwort
Daniel Shub
am 9 Mai 2012
Unfortunately there is no automatic way of doing it. Each ~ can be replaced by a dummy variable name. Something like "dummy" or "temp" might work (assuming you never use dummy/temp as a meaningful variable).
What you want to do is replace
function [x,y,z] = myfun(a,~,c)
with
function [x,y,z] = myfun(a,dummy,c)
and outputs
[x,~,z] = myfun(a,b,c);
with
[x,dummy,z] = myfun(a,b,c);
DO NOT JUST DO A GLOBAL FIND REPLACE for ~, since ~= and ~x means something different and cannot become dummy= and dummyx.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!