How is it possible to slice up a table into smaller ones if the data contains floating point numbers?

2 次查看(过去 30 天)
Hello everyone,
As seen in the attachment I have generated a stacked table with 3 columns and 19000 rows. The columns represent the cartesian coordinates x, y and z and the rows are the according data points. This table will be used as a 3D printer path description for a set of curves (Each curve is "stacked" on each other).
Upon a closer look you will notice that the x values from -75 to 75 are repeating themselves in regular intervals but their row range is totally different due to the fact that these are purely floating numbers generated by a function. (It was important for me to increase the density of data point in some areas and lower the density of data points in other areas)
Therefore I would like to perform the following tasks:
1.) I want to slice up this stacked data table into smaller ones. The criteria for this slicing operation should be the x values from -75 to 75 because the row range varies for each curve. (Therefore each table contains a different amount a data points but they all start from -75 and end with 75).
e.g
1st small Table:
X Y Z
( Amount of data points of each cartesian coordinate: e.g 1557)
2nd small Table:
X Y Z
( Amount of data points of each cartesian coordinate e.g 1241)
3rd small Table:
X Y Z
( Amount of data points of each cartesian coordinate: e.g 1287)
... etc.
2.) I want to insert two text messages above and under each table (e.g text) without the appearance of '' in the table
I have already tried the conservative approach with repshape and unique but it does not work for floating number. The reason for this is because this commands rely on an even row numbers...
I would like to know if somebody i much more keen on the commands/methods regarding this topic since I am still a beginner in matlab. Hence I would like to have a code for this matter.
Stay safe and healthy
David

采纳的回答

dpb
dpb 2021-3-3
ix=find(diff(XYZ(:,1))<0);
will locate the breakpoints where the X coordinate resets.
Remember diff(x) contains one less point in it than does (x) owing to having taken the difference so ix will be the index of the last element of each segment; ix+1 will give the beginning of the next segment.
  7 个评论
dpb
dpb 2021-3-3
That puts all the Start and Stop strings at the head and tail altogether...
Is the need just a display or to embed the string (eventually) into a file?
David Mrozek
David Mrozek 2021-3-3
The purpose was actually to create a cell array with a certain amount of columns and 3 rows. The first row should contain a repetition of first text. the middle test contains the data itself and the third row the 2nd repetition of the text.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by