please fix the error

2 ビュー (過去 30 日間)
Aisha Kohli
Aisha Kohli 2022 年 8 月 9 日
編集済み: Piyush Dubey 2023 年 9 月 7 日
%Comparison of Smoking against Age & Gender
figure(8)
x = cell2mat(heart_failure(:,1));
y = cell2mat(heart_failure(:,11));
g = cell2mat(heart_failure(:,10));
gscatter(x,y,g,'rkgb','o*',8,'on','Age of patients','Smoking')
axis([20 100 -1 2])
title("Smoking Against Gender")
  1 件のコメント
Voss
Voss 2022 年 8 月 9 日
What is the error?

サインインしてコメントする。

回答 (1 件)

Piyush Dubey
Piyush Dubey 2023 年 9 月 7 日
編集済み: Piyush Dubey 2023 年 9 月 7 日
Hi Aisha,
I understand that you are trying to run a code that involves conversion of cell array to an ordinary array and while performing this operation you are facing an error.
Please know that the function cell2mat accepts only cell arrays as inputs and in the code snippet it is unclear if the returned value is of cell array datatype or not.
If the returned datatype is of any format other than cell array, then it can be converted to cell array just by a slight modification of wrapping the value in curly braces.
X = cell2mat({heart_failure(:,1)})
Please refer to the following MathWorks documentation link for more information on “cell2mat” method:
Hope this helps.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by