I have 4*3 table data and I want want to rearragne in only one column.
Like [objectpointsepoch1(:,2) objectpointsepoch1(:,3)] but its 2*3 I need the 6*1 matrix.

1 Comment

I need like this as 2nd column is x1 to s4 and 3rd column is y1 to y4. So I need it as image shown.

Sign in to comment.

 Accepted Answer

Fangjun Jiang
Fangjun Jiang on 28 May 2021
[objectpointsepoch1(:,2); objectpointsepoch1(:,3)]

7 Comments

vimal kumar chawda
vimal kumar chawda on 28 May 2021
Edited: vimal kumar chawda on 28 May 2021
It does not work as I am having different variable so it showing the error as below :-
All tables being vertically concatenated must have the same variable names.
Does this work?
% for i =1:1:4
% for j = 2:1:4
% objectpointsepoch_1(i,j)= objectpointsepoch1(i,j);
% j=j+1
% end
% i=i+1
% end
double check your question, specify that it is for a table data, not matrix. provide a readily available table data, correct the numbers regarding size ([objectpointsepoch1(:,2) objectpointsepoch1(:,3)] should be in the size of 4x2 according to your text file, isn't it?)
Life could be so much easier if you pay a little more attention!
vimal kumar chawda
vimal kumar chawda on 28 May 2021
Edited: vimal kumar chawda on 28 May 2021
I mean after the code which you have wrote it is 4*2 and I want to do for a table data? It sould be 4*1 as answer. Hope now it will be clear. Please check the image as I have uploaded for better explanation of my questions.
reshape(transpose(objectpointsepoch1{:,2:3}),8,[])
Thnak you it works. Can you please explain it so I can apply it in future?
1- Why we used {} type of brackes insted of () type of brackets?
2- What is means 8 and []? Can you say something so I can play with it?
Btw thank you
see examples in
doc table
doc reshape

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!