필터 지우기
필터 지우기

function that gives the number of letters in a word

조회 수: 2 (최근 30일)
Lee
Lee 2013년 4월 30일
for example abcd should be equal 4 when i define a vector w={'abcd','ccb'} length(w(1,1)) gives me 1 and not 4

답변 (2개)

Andrei Bobrov
Andrei Bobrov 2013년 4월 30일
length(w{1}) ;
out = cellfun('length',w);
  댓글 수: 2
Jan
Jan 2013년 4월 30일
w(1,1) is : {'abcd'}, a {1x1} cell and therefore its length is 1. But you want the contents of this cell element, and therefore nedd the curly braces, as Andrei has shown.

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


Walter Roberson
Walter Roberson 2013년 4월 30일

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by