필터 지우기
필터 지우기

how to handle this issue "Error using regexprep"

조회 수: 20 (최근 30일)
Abdul Ghaffar
Abdul Ghaffar 2019년 10월 30일
댓글: Abdul Ghaffar 2019년 11월 4일
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.....

채택된 답변

Daniel M
Daniel M 2019년 10월 30일
편집: Daniel M 2019년 10월 30일
% 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
Daniel M
Daniel M 2019년 10월 30일
I don't see how this is an issue with regexprep at all...
Abdul Ghaffar
Abdul Ghaffar 2019년 11월 4일
Thank you So much Daniel M

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by