Create a double variable array

2 ビュー (過去 30 日間)
James Upton
James Upton 2019 年 7 月 21 日
コメント済み: Rik 2019 年 7 月 21 日
The following code wont work because: I have a date1 variable array which is a double and the P_D variable seems to be a cell array. I need to set P_D to be a double variable, all numbers in the P_D variable are doubles.
Error using plot
Invalid data argument.
Error in thethird (line 54)
plot(date1, P_D(:,1))
CODE:
P_D(i,1)={Premium};
P_D(i,2)= {Call};
P_D(i,3)= {Put};
end
date1 = datenum(date,'yyyy-mm-dd HH:MM:SS');
plot(date1, P_D(:,1))
datetick('x', 'mm-dd')
  6 件のコメント
Walter Roberson
Walter Roberson 2019 年 7 月 21 日
Assign into a numeric array instead.
P_D(i,1)=Premium;
P_D(i,2)= Call;
P_D(i,3)= Put;
Rik
Rik 2019 年 7 月 21 日
Judging from the use of cells in the first place, I would guess either of the other parameters are not scalar doubles. If they are scalar doubles, then there is no need to add the complexity of a cell array.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by