how can I insert text into colum?

2 visualizaciones (últimos 30 días)
Ricardo Castro
Ricardo Castro el 18 de Feb. de 2021
Comentada: Ricardo Castro el 18 de Feb. de 2021
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!

Respuestas (1)

Walter Roberson
Walter Roberson el 18 de Feb. de 2021
Editada: Walter Roberson el 18 de Feb. de 2021
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

Categorías

Más información sobre Statistics and Linear Algebra en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by