how to Enter same string in whole column?
22 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Akashdeep Kaur
am 16 Jul. 2022
Kommentiert: Akashdeep Kaur
am 18 Jul. 2022
Hello, I have a Table some of its columns have variable value but for some i have to fix the column value with a string.
for example:
col1
"str1"
"str1"
"str1"
"str1"
Thank you.
0 Kommentare
Akzeptierte Antwort
Voss
am 16 Jul. 2022
% a table with varying values:
t = table( ...
["str1";"str2";"str3";"str4";"str5"], ...
[1;2;3;4;5], ...
'VariableNames',{'col1','col2'})
% set all the values in col1 to "str1":
t.col1(:) = "str1"
0 Kommentare
Weitere Antworten (1)
Jan
am 16 Jul. 2022
T = table('Size', [5, 2], 'VariableTypes', {'string', 'double'});
T{:, 1} = "str"
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!