replace the data from int to char in the matrix 200x1
1 view (last 30 days)
Show older comments
Muhannad Saleh
on 10 Feb 2021
Commented: Muhannad Saleh
on 10 Feb 2021
hi i need help in matlab i'm new this first time i used my problem is i have a matrix one culome have some number from 1 to 28 i have replace the number with word mean
1 to normal
2 to left
3 to right
and for all number
the table name heart
0 Comments
Accepted Answer
KALYAN ACHARJYA
on 10 Feb 2021
Edited: KALYAN ACHARJYA
on 10 Feb 2021
I am sharing one example here, hope it helps
data=randi(3,[1,10]);
data_cell=table(data);
str_data={'Normal','Left','Right'};
% Just kee those strings as per number accordingly
str_name=cell(1,10);
for i=1:length(data)
str_name(i)=str_data(data(i));
end
T=table(data',table(str_name'))
Result:
T =
10×2 table
Var1 Var2
Var1
___ __________
1 {'Normal'}
3 {'Right' }
3 {'Right' }
3 {'Right' }
1 {'Normal'}
3 {'Right' }
2 {'Left' }
2 {'Left' }
2 {'Left' }
3 {'Right' }
7 Comments
Walter Roberson
on 10 Feb 2021
heart = table(ANNOTD);
names = {'Gummi', 'Normal','Left','Right'};
heart.Word = categorical(heart.ANNOTD, 0:length(names)-1, names)
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!