Saving a rxcx matrix into a larger rxcy matrix
이전 댓글 표시
I currently have a system where a collect gives me 16538 by 15 columns of data as an output for every collect in the series. I am looking to save these 15 columns of data after every scan into a larger matrix so that the raw data can be accessed at a later date for analysis.
for individual 16538 by 1 data sets the following "Data(:, counter) = Spectrum;" works fine, where Data collects 16538 by counter columns until the capture ends.
Instead I am trying to find a way to save Data where the spectrum is 16538 by 15 instead. Anyone have any ideas to sort this simply?
답변 (1개)
Hello Ryan,
The spectrum with a size of (16538, 15) can be incorporated into a larger matrix 'Data' by simply replacing the columns in 'Data' with the 'Spectrum' data.
Here are the steps to add 'Spectrum' data from each scan to the 'Data' matrix:
- Start by pre-allocating the 'Data' matrix according to the total number of scans.
Data = zeros(16538, 15 * totalScans);
- For each scan, identify the columns in the 'Data' matrix that need to be replaced with data from the 'Spectrum'.
for counter = 1:totalScans
Spectrum = rand(16538, 15); % Replace with your Specturm data
startCol = (counter - 1) * 15 + 1;
endCol = counter * 15;
Data(:, startCol:endCol) = Spectrum;
end
For a better understanding of this solution, run the following command in the MATLAB command line to access the documentation on array indexing:
>> web(fullfile(docroot, "matlab/learn_matlab/array-indexing.html"));
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!