Borrar filtros
Borrar filtros

How to delete certain data corresponding of other value?

2 visualizaciones (últimos 30 días)
hj lee
hj lee el 11 de Jun. de 2020
Comentada: hj lee el 12 de Jun. de 2020
Hello,
Here is the example data.
a = [1 2 3 4 5 6 7 8 9 10];
b = [2.5 3.5 4.5];
c = a.*b;
the mablab can't calculate this since the number of data aren't same... so I want to delete
some data a, and I want to make a = [8 9 10]
but, the problem is a and b are depend on what I put the first initial conditions,
so it can be
a = [2 3 4 5 6 7 8 9 10 11];
b = [3.5 4.5];
in this situation, I want to make a = [10 11] (delete the data from the first value)
how to make matlab code which correspond the data automatically?

Respuesta aceptada

KSSV
KSSV el 11 de Jun. de 2020
n = length(b) ;
a = a(end-(n-1):end)

Más respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by