how can I insert text into colum?

1 回表示 (過去 30 日間)
Ricardo Castro
Ricardo Castro 2021 年 2 月 18 日
コメント済み: Ricardo Castro 2021 年 2 月 18 日
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!

回答 (1 件)

Walter Roberson
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
t = 32x13 table
Drive V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 _________ __ __ __ __ __ __ __ __ __ ___ ___ ___ {'20HZ' } 0 0 0 0 0 0 0 0 0 0 0 0 {'25Hz' } 0 0 0 0 0 0 0 0 0 0 0 0 {'31Hz' } 0 0 0 0 0 0 0 0 0 0 0 0 {'39Hz' } 0 0 0 0 0 0 0 0 0 0 0 0 {'50Hz' } 0 0 0 0 0 0 0 0 0 0 0 0 {'63Hz' } 0 0 0 0 0 0 0 0 0 0 0 0 {'79Hz' } 0 0 0 0 0 0 0 0 0 0 0 0 {'99Hz' } 0 0 0 0 0 0 0 0 0 0 0 0 {'125Hz'} 0 0 0 0 0 0 0 0 0 0 0 0 {'157Hz'} 0 0 0 0 0 0 0 0 0 0 0 0 {'198Hz'} 0 0 0 0 0 0 0 0 0 0 0 0 {'250Hz'} 0 0 0 0 0 0 0 0 0 0 0 0 {'315Hz'} 0 0 0 0 0 0 0 0 0 0 0 0 {'297Hz'} 0 0 0 0 0 0 0 0 0 0 0 0 {'500Hz'} 0 0 0 0 0 0 0 0 0 0 0 0 {'630Hz'} 0 0 0 0 0 0 0 0 0 0 0 0
  1 件のコメント
Ricardo Castro
Ricardo Castro 2021 年 2 月 18 日
its Working Thanks!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStatistics and Linear Algebra についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by