Converting a String to Double without str2double

조회 수: 1 (최근 30일)
Sanjin Spahic
Sanjin Spahic 2020년 12월 10일
편집: Sanjin Spahic 2020년 12월 10일
So I have to write a Programm that converts a binary code into a dezimal number.
The problem is that we insert the binary code in form of a string and I'm not supposed to use the str2double command to convert the string.

채택된 답변

Geoff Hayes
Geoff Hayes 2020년 12월 10일
Sanjin - why do you need to convert it using str2double?
check=z(k);
In the above check is a character so you could compare it to '0' or '1'. If neither of these characters, then it is invalid.
  댓글 수: 1
Sanjin Spahic
Sanjin Spahic 2020년 12월 10일
Thank you never thought about to just check if its '0'or '1' like this.
I'm new to pragramming tanks for the help mate.

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

추가 답변 (0개)

카테고리

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