필터 지우기
필터 지우기

How to concatenate cell array with blank

조회 수: 10 (최근 30일)
Karthik KJ
Karthik KJ 2012년 5월 26일
Hi, can anyone help me in concatenating below cell array
{'ob' '^b' [] '$b'}
so that output will be
{'ob' '^b' '$b'}
this is an dynamic output so i could not identify the exact position of blank. Is there any simple method available otherwise i have to use a loop to identify the blank.

채택된 답변

Oleg Komarov
Oleg Komarov 2012년 5월 26일
cs = {'ob' '^b' [] '$b'};
idx = cellfun('isempty',cs);
cs = cs(~idx);

추가 답변 (2개)

Karthik KJ
Karthik KJ 2012년 5월 26일
Hi Oleg, if i have index=[1;0;0] and string={'mean' 'min' 'max'}. As per index my output should be 'mean', how to get this. string(~index) gives ''min'' and ''max''. what is the sign to be used for getting ''mean''
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2012년 5월 26일
~ is the negation operator.
try in your command window:
~index
index
Then it should be clear what to use to get 'mean'.

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


Karthik KJ
Karthik KJ 2012년 5월 27일
thank you oleg. two negation operator can provide as you said. string(~~index)
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2012년 5월 27일
Or you can simply remove the tilde and simple use index.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by