フィルターのクリア

Error in abf2load (line 14) - cmd = sprintf('Abf2Tmp %s',fn); % Not enough input arguments %

2 ビュー (過去 30 日間)
ishita agrawal
ishita agrawal 2017 年 3 月 14 日
コメント済み: ishita agrawal 2017 年 3 月 15 日
I am trying to load an 'abf2' file using following code. But I am getting an error "not enough input arguments" in line 'cmd = sprintf('Abf2Tmp %s',fn)'. Can anyone help me with this?
function [data, metadata] = abf2load(fn) % function [data, metadata]=abf2load(fn) % this will load abf 2.0 files % in order for it to work you must have Abf2Tmp.exe and the dll in your % active directory.
cmd = sprintf('Abf2Tmp %s',fn);
system(cmd);
tmpfname = sprintf('%s.txt',fn);
data = load(tmpfname,'v1');
metaDataFName = sprintf('%s-md.txt',fn);
tabchar = sprintf('\t');
fid = fopen (metaDataFName,'r');
metadata = struct(); %start as an empty struct
while 1
%cycle through all the lines in the file and add all data to the
%metadata struct
tline = fgetl(fid);
if ~ischar(tline), break, end
valOffset = findstr(tline, tabchar);
mdName = tline(1:valOffset-1);
c = mdName(1);
valOffset=[valOffset, size(tline,2)];
for i=1:size(valOffset,2)-1
mdVal = tline(valOffset(i)+1:valOffset(i+1));
if (strcmp(c,'f') || strcmp(c,'n') || strcmp(c,'l') || strcmp(c,'u') || strcmp(c,'b') )
val = str2num(mdVal);
else
val = {mdVal};
end
if (i > 1)
metadata.(mdName) = [metadata.(mdName),val];
else
metadata.(mdName) = val;
end
end
end
fclose(fid);
%clean up
cmd = sprintf('del %s', tmpfname); %command to delete the temp data file
system(cmd);
cmd = sprintf('del %s', metaDataFName); % command to delete the metadata file
system(cmd);

採用された回答

Jan
Jan 2017 年 3 月 14 日
The problem is the calling command, most likely. How do you call this function? You require
[data, metadata] = abf2load(Str)
with a matching value for the string variable "Str". How do you call this function?
  3 件のコメント
Jan
Jan 2017 年 3 月 14 日
編集済み: Jan 2017 年 3 月 14 日
@ishita: While it does not matter, why you call the code, it matters how you do this. Do you provide the needed input argument or do you press the "Run" button of the compiler? In the last case there is no input in general and you would see the mentioned error message.
ishita agrawal
ishita agrawal 2017 年 3 月 15 日
I was pressing "RUN" button. I got the point now. Thak you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by