How i can i Ensure that my 2 vectors have the same size?!
Show older comments
I have the following code (below) and want that DAPEAK_IN (1X86) and DAPEAK_OUT (1X63) have the same size i tried using this code
%Calculate daily averages from CleanPeaks, Max Threshold set to 2000, where 2 is values in and 4 is values out
DAPeaks_in = DailyAverageNY(CleanPeaks_in,2,5,100);
DAPeaks_out = DailyAverageNY(CleanPeaks_out,4,5,100);
DAPeaks_in = DAPeaks_in(1:size(DAPeaks_out,1),:); % adjust the size of DAPEAKS_IN to DAPEAKS_OUT and vice versa
DAPeaks_out = DAPeaks_out(1:size(DAPeaks_in,1),:)
however the stil have the same size as before DAPEAK_IN (1X86) and DAPEAK_OUT (1X63) - any suggestion on how to achevie this FYI i have not tried any function for it
best regards - Amil Ali
Accepted Answer
More Answers (1)
KALYAN ACHARJYA
on 1 May 2023
Edited: KALYAN ACHARJYA
on 1 May 2023
Hope I have understand the question- Here is the example
DAPEAK_IN=randi([1,100],[1,randi(200)]); %Random data
size(DAPEAK_IN)
DAPEAK_OUT=randi([1,100],[1,randi(200)]); %Random data
size(DAPEAK_OUT)
if size(DAPEAK_IN,2)>size(DAPEAK_OUT,2)
DAPEAK_IN=DAPEAK_IN(1:size(DAPEAK_OUT,2));
else
DAPEAK_OUT=DAPEAK_OUT(1:size(DAPEAK_IN,2));
end
size(DAPEAK_IN)
size(DAPEAK_OUT)
The size can also be done with extrapolate, actually representing the data set. Here I have foreced the data in particular range, the remaining will be lost which may be meningful data, please look on that point.
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!