how can I insert text into colum?
2 次查看(过去 30 天)
显示 更早的评论
Hi I have a FIR array 33x 13 and I want to insert on the first colum the "text" of the deFIR Vector 33x1,
FIR = zeros(33,13)
Cimo = (0:12)
FIR (1,:)= Cimo
deFIR = {'Drive','20HZ','25Hz','31Hz','39Hz','50Hz','63Hz','79Hz','99Hz','125Hz','157Hz','198Hz','250Hz','315Hz','297Hz','500Hz','630Hz','794Hz','1000Hz','1260Hz','1587Hz','2000Hz','2520Hz','3175Hz','4000Hz','5040Hz','6350Hz','800Hz','10079Hz','12699Hz','16000Hz','20000Hz','Delay'}'
how can I insert one of the colums of my array with simple text as described!
0 个评论
回答(1 个)
Walter Roberson
2021-2-18
编辑:Walter Roberson
2021-2-18
You cannot. Your FIR array is numeric, and numeric arrays can never store text.
You can use a table, such as
FIR = zeros(33,13); %not really
Cimo = (0:12); %not really
deFIR = {'Drive','20HZ','25Hz','31Hz','39Hz','50Hz','63Hz','79Hz','99Hz','125Hz','157Hz','198Hz','250Hz','315Hz','297Hz','500Hz','630Hz','794Hz','1000Hz','1260Hz','1587Hz','2000Hz','2520Hz','3175Hz','4000Hz','5040Hz','6350Hz','800Hz','10079Hz','12699Hz','16000Hz','20000Hz','Delay'}';
t = cell2table(deFIR(2:end));
t = [t, num2cell(FIR(2:end,2:end))];
t.Properties.VariableNames = [deFIR{1},"V"+Cimo(2:end)];
t
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Linear Algebra 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!