필터 지우기
필터 지우기

Conversion to double from cell is not possible

조회 수: 84 (최근 30일)
Kenneth
Kenneth 2024년 8월 7일
댓글: Voss 2024년 8월 12일
I'm working with a script that simulates a communication channel, and am running into a "Conversion to doube from cell is not possible". The line throing an error works normally in a script, however when I put it inside a custom defined function within my script I get an error.
R is a 1339x17 double
D is a 16384x1 double
N, Npst, and Npre are constants of 1352, 13, and 2, respectively.
How could I cast the cell into a double without having an error being thrown?
Thanks!

채택된 답변

Voss
Voss 2024년 8월 7일
Set a breakpoint at that line in your function, and when the breakpoint is triggered, check the class of D. I suspect you'll find it is a cell array.
The problem may be that you have some other variable in the function, also called D, which is a cell array, and which is defined later than the double D, and so it is replacing the initially-defined double D. (This is why it's necessary to check the variable(s) when the line is actually executed.)
  댓글 수: 2
Kenneth
Kenneth 2024년 8월 12일
Thanks!
Voss
Voss 2024년 8월 12일
You're welcome!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by