MATLAB Answers

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

52 views (last 30 days)
David Mrozek
David Mrozek on 3 Mar 2021
Commented: David Mrozek on 3 Mar 2021
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).
1st small Table:
( Amount of data points of each cartesian coordinate: e.g 1557)
2nd small Table:
( Amount of data points of each cartesian coordinate e.g 1241)
3rd small Table:
( 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

Accepted Answer

dpb on 3 Mar 2021
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.
David Mrozek
David Mrozek on 3 Mar 2021
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by