Filter löschen
Filter löschen

How do I acquire multiple datasets using readwrite?

8 Ansichten (letzte 30 Tage)
Brianna Miranda
Brianna Miranda am 1 Mär. 2022
Bearbeitet: Shushant am 29 Sep. 2023
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]);

Antworten (1)

Shushant am 29 Sep. 2023
Bearbeitet: Shushant am 29 Sep. 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)]
Refer to the following documentation for more information on indexing-
I hope this suggestions helps in solving the issue you were facing.
Thank you,


Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by