How do I replace [ ] in an array with 0's
이전 댓글 표시

How can i replace the [] in the pathrisk field with 0's?
Thanks for your help!
채택된 답변
추가 답변 (1개)
Jos (10584)
2014년 1월 15일
편집: Jos (10584)
2014년 1월 15일
If I am not mistaken, the variable pathrisk is a cell array with some empty cells?
pathrisk = {1 [] 5 3 [] [] 9} % example data
tf = cellfun('isempty',pathrisk) % true for empty cells
pathrisk(tf) = {0} % replace by a cell with a zero
댓글 수: 4
Abolfazl Nejatian
2019년 11월 27일
Dear Jos,
your responce was very helpful for me.
thank you so much.
Fernando Galaz Prieto
2020년 9월 23일
Upvoting!
Thank you very much.
Abdullateef Agbaje
2021년 1월 23일
Thank you
Ioannis Vourvachakis
2021년 10월 11일
thank you so much!!
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!