-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MATLAB Improvements #219
MATLAB Improvements #219
Conversation
…ared only temporarily and to be restored at the end of the bart call Added separation of varargin inputs into character inputs and data inputs. Character inputs are then appended to the given bart command. This enables calling of only "bart" or "bart traj -h" commands from within matlab, e.g. when no data input is given Renamed loop variables ("i" should not be used as it represents the complex number) Better function description when using the help command Added section comments and cleaned up formatting warnings
matlab/bart.m
Outdated
|
||
% Check input variables | ||
if nargin==0 || all(cmd==0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all(cmd==0) actually be isempty(cmd)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all(cmd==0) does seem to work, but is not as elegant, true. I have changed it to isempty(cmd)
if isempty(bart_path) | ||
if exist('/usr/local/bin/bart', 'file') | ||
bart_path = '/usr/local/bin'; | ||
elseif exist('/usr/bin/bart', 'file') | ||
bart_path = '/usr/bin'; | ||
else | ||
% Try to execute bart inside wsl, if it works, then it returns | ||
% status 0 | ||
% Try to execute bart inside wsl, if it works, then it returns status 0 | ||
[bartstatus, ~] = system('wsl bart version -V'); | ||
if bartstatus==0 | ||
bart_path = '/usr/bin'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see, the variable bart_path is actually not used for the WSL code branch below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct, I'm running bart on a native ubuntu, not using wsl - so I did not bother checking. Nevertheless, I changed the code to use bart_path as well in the wsl part, see 69e988d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but how do we know that bart is in /usr/bin ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't, as far as I understand, this probably very ancient piece of code, it just assumes this as default location in case the TOOLBOX_PATH is not set. Because WSL 2 is supposed to be released soon (https://docs.microsoft.com/en-us/windows/wsl/wsl2-index this will probably require an overhaul with WSL 2 anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, got it. I might play with it once I upgrade to WSL 2.
Can someone check with octave? |
Is there something specific you want checked? The interface still works with octave on Linux. |
I have also just tried it on a fresh install of octave 5.2.0 (never even used octave before) and a quick test appeared to have worked out of the box:
|
I have given the MATLAB wrappers some love and implemented the following improvements:
Major Changes
LD_LIBRARY_PATH
(Linux) andDYLD_LIBRARY_PATH
(Mac) is now only applied temporarily and the variables are restored to their original value at the end of the bart function. This is important as the clearing of those variables could influence or break other MATLAB functions.Minor Changes
bart.m
,writecfl.m
andreadcfl.m
when using the MATLAB help commandWSLPathCorrection
to lower casewslPathCorrection
for file naming consistency