Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How can I fix the error, or what does it mean "Subscript indices must either be real positive integers or logicals."?

2 ビュー (過去 30 日間)
juan Ortiz
juan Ortiz 2018 年 2 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Densityex = [ 0.974 0.938 0.948 0.932 0.893 0.865 0.863 0.844]; Tempex= [ 24 25 25 25.6 25.2 24.2 24.1 24.1]; alpha = 25*10^-6; Density = zeros(1:numel(Densityex)); for i =1:numel(Densityex) n = Densityex(i); for j = 1:numel(Tempex) N = Tempex(j); Density(n,N) = Densityex(n)*(1+ alpha(Tempex(N)-60)); end end

回答 (1 件)

Roger Stafford
Roger Stafford 2018 年 2 月 22 日
The error refers to the line
Density(n,N) = ...
because both n and N are being as indices in 'Density' but neither are positive integers, as all indices must be.

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by