Azzera filtri
Azzera filtri

how to handle this issue "Error using regexprep"

20 visualizzazioni (ultimi 30 giorni)
Hello @ ALL I am using PLS-SEM. An error occure "Error using regexprep All cells must be char row vectors."
LMV_labels is 14×1 cell array consist of
{["usm1" ]}
{["usm2" ]}
{["usm3" ]}
{["usm4" ]}
{["owrl1"]}
{["owrl2"]}
{["owrl3"]}
{["owrl4"]}
{["crt1" ]}
{["crt2" ]}
{["crt3" ]}
{["crt4" ]}
{["crt5" ]}
{["crt6" ]}
I want to convert them in the format like
{ 'usm1' }
{ 'usm2' }
and so on.....

Risposta accettata

Daniel M
Daniel M il 30 Ott 2019
Modificato: Daniel M il 30 Ott 2019
% Assuming this is what you have...
labels = {{["usm1" ]} ,{["usm2" ]},{["usm3" ]},{["usm4" ]},...
{["owrl1"]},{["owrl2"]},{["owrl3"]},{["owrl4"]},{["crt1" ]},...
{["crt2" ]},{["crt3" ]},{["crt4" ]},{["crt5" ]},{["crt6" ]}};
% then you can convert using cellfun
newlabels = cellfun(@(v) char(v{1}),labels, 'UniformOutput',false);
  2 Commenti
Daniel M
Daniel M il 30 Ott 2019
I don't see how this is an issue with regexprep at all...

Accedi per commentare.

Più risposte (0)

Prodotti


Release

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by