Patients code to text for table
이전 댓글 표시
Hi All. Cannot get to read numbers from a matrix and make them into a text to be inserted in a table. The latter to be used in a ranova test. For example.
Injection = [1;1;2;2;3]
Table (1:5,x) = ['Upper_limb', 'Upper_limb','Lower_limb','Lower_limb','Back'];
cheers
Eduardo
댓글 수: 1
Walter Roberson
2018년 8월 20일
Is Table intended to be a table() object? Is x intended to be a column number in the table object?
Are you trying to do something like
Injection = [1;1;2;2;3]
Table = table(Injection);
Table(1:5,2) = {'Upper_limb', 'Upper_limb','Lower_limb','Lower_limb','Back'} .';
채택된 답변
추가 답변 (4개)
Luis Eduardo Cofré Lizama
2018년 8월 21일
편집: Walter Roberson
2018년 8월 21일
댓글 수: 1
Walter Roberson
2018년 8월 21일
Injection = [1;1;2;2;3]
limbs = {'Upper_limb', 'Upper_limb','Lower_limb','Lower_limb','Back'} .';
Table = limbs(Injection);
See also categorical()
Ben Morrow
2018년 8월 21일
0 개 추천
just re-format before calling it
%lets say
Injection = [1;1;2;2;3] %Sort into names that you want
Upper_limb1 = Injection(1);
Upper_limb2 = Injection(2);
Lower_limb1 = Injection(3);
Lower_limb2 = Injection(4);
Back = Injection(5);injTable = table(Upper_limb1, Upper_limb2,Lower_limb1,Lower_limb2,Back)
%now just call your table as "injTable" when you need it %--------------------------------------------------------------
%now lets say its a row of data...
Injection = [1,1;1,1;2,2;2,2;3,3]Injection = transpose(Injection);
%Sort into names that you want
Upper_limb1 = Injection(:,1);
Upper_limb2 = Injection(:,2);
Lower_limb1 = Injection(:,3);
Lower_limb2 = Injection(:,4);
Back = Injection(:,5);Table = table(Upper_limb1, Upper_limb2,Lower_limb1,Lower_limb2,Back
%now just call "Table" for your column table
댓글 수: 1
Ben Morrow
2018년 8월 21일
just saw walters... that works too
Luis Eduardo Cofré Lizama
2018년 8월 21일
편집: Walter Roberson
2018년 8월 21일
댓글 수: 1
Walter Roberson
2018년 8월 21일
Injection = [1;1;2;2;3]
limbs = {'Upper_limb', 'Upper_limb','Lower_limb','Lower_limb','Back'} .';
Injection_site = limbs(Injection);
Table = table(Injection_site);
Luis Eduardo Cofré Lizama
2018년 8월 31일
0 개 추천
댓글 수: 1
Walter Roberson
2018년 8월 31일
I already gave the code for that, such as https://www.mathworks.com/matlabcentral/answers/415580-patients-code-to-text-for-table#comment_601756
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!