Hey,
I would like to replace numbers (-999) as char with a 0 for all -999 in a specific column.
Thanks already!

 채택된 답변

Titus Edelhofer
Titus Edelhofer 2014년 7월 6일

0 개 추천

Hi,
it sounds as if you have a cell array of strings. In this case
allDatabySubj(strcmp(allDatabySubj, '-999)) = {0};
should do the trick.
Titus

댓글 수: 1

Image Analyst
Image Analyst 2014년 7월 6일
julro's "Answer" moved here since it's not an ANswer/solution to the original question:
Thanks a lot! That was the trick:).

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

추가 답변 (1개)

dpb
dpb 2014년 7월 6일

0 개 추천

x(x(:,colID)==-999,colID)=0;
for your specific column in colID

댓글 수: 3

Image Analyst
Image Analyst 2014년 7월 6일
That's kind of what I was thinking but I could never figure out what the "numeric char" or "as char" part meant. I didn't know if the array was numeric, character (but with numbers as the characters), or possibly even a cell array.
dpb
dpb 2014년 7월 6일
It doesn't make any sense and I don't know what was intended by it either but I am guessing it is just poor grammar from non-English native tongue poster...
Image Analyst
Image Analyst 2014년 7월 6일
julro's "Answer" moved here since it's not an ANswer/solution to the original question:
Thanks! Char means character, sorry. I am getting the following error message:
>> allDatabySubj(allDatabySubj(:,6)==-999,6)=0; ??? Undefined function or method 'eq' for input arguments of type 'cell'.

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

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

질문:

2014년 7월 5일

댓글:

2014년 7월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by