how to handle this issue "Error using regexprep"

19 visualizaciones (últimos 30 días)
Abdul Ghaffar
Abdul Ghaffar el 30 de Oct. de 2019
Comentada: Abdul Ghaffar el 4 de Nov. de 2019
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.....

Respuesta aceptada

Daniel M
Daniel M el 30 de Oct. de 2019
Editada: Daniel M el 30 de Oct. de 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 comentarios
Daniel M
Daniel M el 30 de Oct. de 2019
I don't see how this is an issue with regexprep at all...
Abdul Ghaffar
Abdul Ghaffar el 4 de Nov. de 2019
Thank you So much Daniel M

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by