Algorithm for data arrangement

4 views (last 30 days)
Mohammed Lamine Mekhalfia
Mohammed Lamine Mekhalfia on 19 Aug 2021
Dear All, I hope that you are all wll
I hope I will be able to explain my problem as good as it should.
I have three column vectors, the vectors size is different.
I would like to build a new vector let say we name it VectorA, this vector contain the 1st value of Vector 1 and the 1st value from vector 2 and the 1st value from vector 3 he will repeat the picking the value at a regular step let say 30 from each vector until the end.
Then the vector B it will take the second value from the vector 1 and with the same concept and repeated steps.
The C , D ...etc unttil the nmber of vectors equal to the Number of step used to pick values.
if the size of original vectors is not devidble on the step choosen, the code need to fill the vector contructed with zeros.
This the code I started with I could not achieve the described point I just worked on the conditioning of the vectors data. Just to show that I made an effort so please do not focus on it but to let you know only that vector 1 and vector 2 and vector 3 are the same as sensor 1 and sensor 2 and sensor 3.
clc
clear all
T = readtable('Results for 400 rpm.xls');
OPR=T.OPR;
OPR= OPR(~isnan(OPR));
OPR=repelem(OPR,29);
Sensor1=T.Sensor1;
Sensor2=T.Sensor2;
Sensor3=T.Sensor3;
Sensor1(Sensor1<12281291) = []
Sensor2(Sensor2<12281291) = []
Sensor3(Sensor3<12281291) = []
size(OPR)
% a=size(OPR)
% b=size(OPR)/29
size(Sensor1)
size(Sensor2)
size(Sensor3)

Answers (0)

Categories

Find more on Model Predictive Control Toolbox in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!