how to get the ceiling and floor values of data in an array?

5 visualizaciones (últimos 30 días)
Hatim Altarteer
Hatim Altarteer el 29 de Ag. de 2021
Respondida: Walter Roberson el 29 de Ag. de 2021
i have a file that holds 100x3 values of coordinates. the 3 columns represent the xyz plain.
taking the first row of values in the pCoords file, we have:
[120.639107128470, 0.677434823554889, 76.2799587504780]
i want to make an array that has the values of both ceiling and floor of all the values in the array.
for instance, i want an array which stores the [120,121], [0,1], and [76,77] and rest of the values.
can anyone help me?
thanks!

Respuestas (1)

Walter Roberson
Walter Roberson el 29 de Ag. de 2021
output = permute(cat(3, floor(pCoords), ceil(pCoords)), [1 3 2])
the result will be 100 x 2 x 3 -- so for any given location pCoords(J,K), output(J,:,K) will be the row of two values corresponding to the floor and ceiling. This output arrangement was chosen because you show the output in the form of a row for each value.

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by