How do I add a variable to string and show the correct variable value?

4 ビュー (過去 30 日間)
Martin Matisoff
Martin Matisoff 2017 年 6 月 1 日
回答済み: Steven Lord 2017 年 6 月 1 日
Here is my code:
filename = 'E:\DataSet.csv';
INPUT=csvread(filename,1,0);
DOY=INPUT(:,1); Rs=INPUT(:,3);
i = 260 n = 262
for J = i:n index(J)=find(DOY==J);nJ=length(indexJ); % find sum of all Rs where DOY = 260 Rs(J)=sum(Rs(index(J):Rs(J)(nJ))); fprintf('index(J) = %d ', index(J)
This is what I want...
Rs260 = sum(Rs_260) Rs261 = sum(Rs261) Rs262 = sum(Rs_262)

回答 (1 件)

Steven Lord
Steven Lord 2017 年 6 月 1 日
DON'T DO THIS. Use the alternatives described here instead.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by