필터 지우기
필터 지우기

how can i convert table of string to a single row vector

조회 수: 8 (최근 30일)
Taha
Taha 2022년 11월 28일
답변: Seth Furman 2022년 11월 28일
i want to make a single vector of transcript character as a single row without these symbols " "

답변 (2개)

Voss
Voss 2022년 11월 28일
Something like this?
% making a table like yours:
transcript = table(["the"; "discreet"; "forier"; "transform"; "of"],[0.99085; 0.89288; 0.92346; 0.87114; 0.74899], ...
'VariableNames',{'Transcript' 'Confidence'})
transcript = 5×2 table
Transcript Confidence ___________ __________ "the" 0.99085 "discreet" 0.89288 "forier" 0.92346 "transform" 0.87114 "of" 0.74899
% make a row vector of the words in the first column:
result = sprintf('%s',transcript{:,1})
result = 'thediscreetforiertransformof'
% or maybe this is better:
result = sprintf('%s ',transcript{:,1});
result(end) = ''
result = 'the discreet forier transform of'

Seth Furman
Seth Furman 2022년 11월 28일
Better yet, just call join on the Transcript variable
transcript = table(["the"; "discreet"; "forier"; "transform"; "of"],[0.99085; 0.89288; 0.92346; 0.87114; 0.74899], ...
'VariableNames',{'Transcript' 'Confidence'})
transcript = 5×2 table
Transcript Confidence ___________ __________ "the" 0.99085 "discreet" 0.89288 "forier" 0.92346 "transform" 0.87114 "of" 0.74899
join(transcript.Transcript)
ans = "the discreet forier transform of"

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by