Someone pls help me why line 3 got error. I've already put the ami_encoding in a file, named ami_encoding, but it still not work
the main file:
the ami_encoding file:
It says :
Error using ami_encoding
Invalid input bit: only '0' and '1' are allowed.
Error in bainop (line 3)
encoded_signal = ami_encoding(input_bits);

 채택된 답변

Voss
Voss 2024년 3월 9일
편집: Voss 2024년 3월 9일

1 개 추천

Use
if input_bits(bit) == '0'
instead of
if bit == '0'
and similarly for the elseif statement.
bit is the index; input_bits(bit) is the character at that index from character vector input_bits.

추가 답변 (2개)

Les Beckham
Les Beckham 2024년 3월 9일
편집: Les Beckham 2024년 3월 9일

1 개 추천

It would have been better if you had posted your code as code (text) rather than a picture, then we could have modified it and run it to show how to fix it. I'm not going to type in your code, so I will just make a suggestion on how to fix it and let you modify your code to see if it works.
Change if bit == to if input_bits(bit) ==.
Quoc Anh
Quoc Anh 2024년 3월 12일

0 개 추천

Thank you guys !! I got it

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2024년 3월 9일

답변:

2024년 3월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by