how to handle this issue "Error using regexprep"

20 vues (au cours des 30 derniers jours)
Abdul Ghaffar
Abdul Ghaffar le 30 Oct 2019
Commenté : Abdul Ghaffar le 4 Nov 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.....

Réponse acceptée

Daniel M
Daniel M le 30 Oct 2019
Modifié(e) : Daniel M le 30 Oct 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 commentaires
Daniel M
Daniel M le 30 Oct 2019
I don't see how this is an issue with regexprep at all...
Abdul Ghaffar
Abdul Ghaffar le 4 Nov 2019
Thank you So much Daniel M

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by