필터 지우기
필터 지우기

Why am I not getting output in the combinations of salts field?

조회 수: 2 (최근 30일)
Muazma Ali
Muazma Ali 2022년 9월 25일
댓글: Muazma Ali 2022년 9월 25일
Hi ! :)
I am attaching a shorter version of my program. Here all the variables get values as input whereas in my program I have functions to give these variables values.
When I run my program I get the following error:
'' Conversion to double from cell is not possible''
and the error is related to this line:
Osmotisk_data(nr_zones_analyzed,:)={nr_zones_analyzed, combinations_of_salts, vekt_prosent_best_salt_1,vekt_prosent_best_salt_2, samlet_vannaktivitet,Osmotic_pressure}
And when I run the attached file, the combinations of salts field stays empty.. and doesnt get any value..
can somebody tell me what wrong I have done in my programming of my code..?
  댓글 수: 1
Stephen23
Stephen23 2022년 9월 25일
"can somebody tell me what wrong I have done in my programming of my code..?"
The array OSMOTISK_DATA is apparently double type, and you are trying to assign a cell array to it.
It is not possible to assign a cell array to a double.

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

답변 (1개)

Walter Roberson
Walter Roberson 2022년 9월 25일
You assign string into C and copy that to combination of salts, and then put that as the second entry in the cell. The cell gets assigned as a table row, so the data type of each position in the cell must match the data type of the corresponding column by position (not by variable name.) But the second variable is double, according to vartypes.
  댓글 수: 1
Muazma Ali
Muazma Ali 2022년 9월 25일
@Walter Roberson so you are saying there is nothinh wrong with the code just that the second variable has to be string..?

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

카테고리

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