Minimale en maximale data uit de matrix filteren
Mostrar comentarios más antiguos
In mijn dataset wil ik alle data boven de 12,5 en onder de 8 vervangen door een 0 in bijvoorbeeld kolom 1 tot 6. Het moet een script zijn die gebruikt kan worden bij verschillende datasets, de input data is variabel.
Wat kan ik hiervoor gebruiken?
Respuestas (1)
what about something like that:
mat=[7 8 9 10 11 12 13;
1 2 4 5 8 2 12;
3 6 10 15 1 6 8];
colsToEdit=[1 3 7];
replaceWithBordersAandBinCols(mat,12.5,8,colsToEdit)
function matrixOut=replaceWithBordersAandBinCols(matrixIn,A,B,colsToWorkOn)
whereToReplace=matrixIn(:,colsToWorkOn)>A | matrixIn(:,colsToWorkOn)<B;
matrixOut=matrixIn;
matrixIn=matrixIn(:,colsToWorkOn);
matrixIn(whereToReplace)=0;
matrixOut(:,colsToWorkOn)=matrixIn;
end
Categorías
Más información sobre Vehicle Network Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!