Using Matlab to Organize Excel Data into Separate Columns

3 vues (au cours des 30 derniers jours)
Mariah Titsworth
Mariah Titsworth le 18 Nov 2019
I am trying to create a script to separate data that is currently all in one column into three seperate columns. This column contains X, Y, and Z coordinates for a particular objects, seen in Figure 1. I need to create a script inorder to arrange the data to the format in Figure 2. I am having difficulties trying to figure out how to start the code, how to move the values, and how to delete the two additional object names once the data is moved. The data will then need to be exported into an Access Database. Can anyone please help me?
Figure 1
Current Sheet.PNG
Figure 2
Format Needed.PNG

Réponse acceptée

Guillaume
Guillaume le 18 Nov 2019
It's trivial to do with unstack:
demodata = table(repelem({'Object1'; 'Object2'}, 3), repmat({'X'; 'Y'; 'Z'}, 2, 1), rand(6, 1)*6000-3000, ...
'VariableNames', {'Name', 'Control', 'Meas'})
unstack(demodata, 'Meas', 'Control')

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by