please I have the following matrixes T =
5.1000 3.5000 1.4000 0.2000
6.4000 3.2000 4.5000 1.5000
5.4000 3.4000 1.7000 0.2000
5.7000 2.8000 4.5000 1.3000
5.7000 4.4000 1.5000 0.4000
5.6000 2.9000 3.6000 1.3000
I want to put labels in tabular form to get T =
A B C D Class
5.1000 3.5000 1.4000 0.2000 b1
6.4000 3.2000 4.5000 1.5000 b2
5.4000 3.4000 1.7000 0.2000 b1
5.7000 2.8000 4.5000 1.3000 b2
5.7000 4.4000 1.5000 0.4000 b1
5.6000 2.9000 3.6000 1.3000 b2
Please guide me on this
thanks in advance
Tino

 채택된 답변

madhan ravi
madhan ravi 2019년 5월 3일

0 개 추천

T=array2table(T);
T.CLASS=repmat(['b1';'b2'],3,1);
T.Properties.VariableNames={'A','B','C','D','CLASS'}

댓글 수: 6

Tino
Tino 2019년 5월 3일
Hi Madhan
Thanks for your swift response
If i want to make the table like how do i do it in code
Thanks in advance
Tino
order A B C D Class
1 5.1000 3.5000 1.4000 0.2000 b1
2 6.4000 3.2000 4.5000 1.5000 b2
3 5.4000 3.4000 1.7000 0.2000 b1
4 5.7000 2.8000 4.5000 1.3000 b2
5 5.7000 4.4000 1.5000 0.4000 b1
6 5.6000 2.9000 3.6000 1.3000 b2
madhan ravi
madhan ravi 2019년 5월 3일
편집: madhan ravi 2019년 5월 3일
clear all
T =[...
5.1000 3.5000 1.4000 0.2000
6.4000 3.2000 4.5000 1.5000
5.4000 3.4000 1.7000 0.2000
5.7000 2.8000 4.5000 1.3000
5.7000 4.4000 1.5000 0.4000
5.6000 2.9000 3.6000 1.3000];
T=[(1:6).',T];
T=array2table(T);
T.CLASS=repmat(['b1';'b2'],3,1);
T.Properties.VariableNames={'Order','A','B','C','D','CLASS'}
Tino
Tino 2019년 5월 3일
Hi Madhan
thanks for respoinding
I am getting the following errors
Unable to perform assignment because dot indexing is not supported for variables of this type.
Error in fishy (line 9)
T.CLASS=repmat(['b1';'b2'],3,1);
Tino
Tino 2019년 5월 3일
Thanks
Sazid Hasan
Sazid Hasan 2021년 8월 27일
If I want to split the class fast 3 as b1 and last 3 as b2, how i can do it?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

릴리스

R2019a

태그

아직 태그를 입력하지 않았습니다.

질문:

2019년 5월 3일

댓글:

2021년 8월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by