How do I acquire multiple datasets using readwrite?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to record multiple stacks of data. This is the code I have so far, but it overwrites the existing saved file when I try to record multiple stacks. How do I get this code to save each acquired source data stack into a matrix?
N = 5; % number of stacks
timeBtw = 4; % time between stacks
timeBuff = 3; % buffer time
buffer = zeros(timeBuff/dt,1);
trigger = 1.5*[s_square;s_buffer];
source = 0.5*[s;s_buffer];
for i=1:N
[data,startTime] = readwrite(ad2,[source trigger]);
pause(timeBtw)
end
0 comentarios
Respuestas (1)
Shushant
el 29 de Sept. de 2023
Editada: Shushant
el 29 de Sept. de 2023
Hi Brianna Miranda,
I understand that you are attempting to record multiple stacks of data, and to accomplish this, you are using a "for" loop. However, you have noticed that the "data" variable is being overwritten within each iteration of the loop, resulting in the undesired behavior.
To address this issue, you can modify your code by converting the variables "data" into "cellarray" and "startTime" into vectors of the appropriate size and dimensions based on your requirements.
Refer to the following documentation for more information on "cellarray"-
Additionally, ensure that you pass the correct index to the matrices "source" and "trigger" according to your specific needs.
Kindly, refer to the following code snippet as an example of how you can make these modifications:
for i=1:N
[data{i},startTime(i)] = readwrite(ad2,[source(:,i) trigger(:,i)]);
% The size of data(:,:,i) must be equal to [source(:,i) trigger(:,i)]
pause(timeBtw)
end
Refer to the following documentation for more information on indexing-
I hope this suggestions helps in solving the issue you were facing.
Thank you,
Shushant
0 comentarios
Ver también
Categorías
Más información sobre Simultaneous and Synchronized Operations 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!