-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restrucuting - replaced cfg.vol and vol by cfg.headmodel and headmode…
…l in most (if not all) parts of the code, according to http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=1547 git-svn-id: svn+ssh://svn.fcdonders.nl/home/svnroot/fieldtrip/trunk@10541 0cf7c7f0-3615-4144-b4e6-68da3bce3cd0
- Loading branch information
1 parent
a727a6a
commit 88b82ea
Showing
54 changed files
with
1,042 additions
and
1,041 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
function value = loadvar(filename, varname) | ||
|
||
% LOADVAR is a helper function for cfg.inputfile | ||
|
||
% Copyright (C) 2010, Robert Oostenveld | ||
% | ||
% $Id$ | ||
|
||
assert(ischar(filename), 'file name should be a string'); | ||
|
||
if nargin<2 | ||
fprintf('reading variable from file ''%s''\n', filename); | ||
else | ||
assert(ischar(varname), 'variable name should be a string'); | ||
fprintf('reading ''%s'' from file ''%s''\n', varname, filename); | ||
end | ||
|
||
% note that this sometimes fails, returning an empty var | ||
% this is probably due to MATLAB filename and MATLAB version issues | ||
var = whos('-file', filename); | ||
|
||
if length(var)==0 && nargin==1 | ||
filecontent = load(filename); % read everything from the file, regardless of how the variables are called | ||
varname = fieldnames(filecontent); | ||
if length(varname)==1 | ||
% the one variable in the file will be returned | ||
value = filecontent.(varname{i}); | ||
clear filecontent | ||
else | ||
error('cannot read an unspecified variable in case of a file containing multiple variables'); | ||
end | ||
|
||
elseif length(var)==1 | ||
filecontent = load(filename); % read the one variable in the file, regardless of how it is called | ||
value = filecontent.(var.name); | ||
clear filecontent | ||
|
||
else | ||
filecontent = load(filename, varname); | ||
value = filecontent.(varname); % read the variable named according to the input specification | ||
clear filecontent | ||
end | ||
|
Oops, something went wrong.