Size Function: Too many arguments-- only after second iteration

1 visualización (últimos 30 días)
James
James el 26 de Feb. de 2012
I'm developing a matlab code to open large quantities of data using an existing routine (abf2load), compile all results into a cell array, and then through matlab's report generator will build figures based on the data in each cell array.
I've encountered trouble using the SIZE function. Also, encountered the same problem using length.
The program can process the sequence of files just fine. But to the array I needed to append an additional sequence. However, different files may have different lengths, so I opted to call the size function in order to determine how big of an area I needed. The first file has 1000 datapoints, the second sample has 25000. On the command line, everything works fine. The short device works fine as well.
For the second iteration, however:
??? Error using ==> size
Too many output arguments.
Error in ==> devicereport at 36
[q, ~] = size(abfData{devicenum:protocolnum});
I'm trying to keep the software flexible so I don't want to just hardprogram the timescales I'm using. There are not too many output arguments here. I was wondering if perhaps with 25,000 rows this dataset had just gotten too huge--- but again, I call the same request from the command line after the function crashes and it gives me the needed 25,000.
I have posted my code below, if anyone has any tips, that would be appreciated.
% This m file was developed by to load, process, and
% display large numbers of very boring files. It will call abf2load.m in
% order to load the electrophys recordings, then will generate the report.
% Work in progress. Filedate 2/24/2012
devicenum=1;
protocolnum=1;
lastprotocol=5
x = input('How many devices are we processing today? (full chip = 100 devices): ');
%each device has x=(protocolnum) recordings associated with it, I need to
%be able to capture the timescales associated with it. For the first set,
%the first recording was short, the others were long, but i want this to
%adapt to file length to make reporting really easy even when caputing cell
%data.
for k = 1:(x*5)
abfFilename = sprintf('Device%d.abf', k);
[abfData{devicenum,protocolnum}, b] = abf2load(abfFilename);
%Now we want to create the time sequence. b is the interval in
%microseconds, so lets find the size of the array... oh the ~ ignores the
%number of columns.
[q, ~] = size(abfData{devicenum:protocolnum});
%done, now we need to create an array to merge into abfData. I need to
%find out if this starts at the first interval or the tenth. see? the
%array will start at 0, count up by b, for the total number of samples
% then we will merge in the timescale data
timescale = b:b:q*b;
abfData{devicenum,protocolnum}(1:q,3) = timescale;
clear b
if protocolnum == lastprotocol
devicenum = (devicenum+1);
protocolnum = 1;
else
protocolnum=(protocolnum+1)
end
end
protocolnum=1
devicenum=1

Respuestas (1)

Walter Roberson
Walter Roberson el 26 de Feb. de 2012
Change
[q, ~] = size(abfData{devicenum:protocolnum});
to
[q, ~] = size(abfData{devicenum,protocolnum});
Comma instead of colon.

Categorías

Más información sobre Testing Frameworks en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by