我想将一组值分隔为直方图图表的分档。我的直方图中会有10个垃圾箱。要排序和计算每个箱中的箱数,我正在使用一个数组。我得到的错误是The operand of an increment or decrement operator must be a variable, property or indexer
。 idx会给我需要增加的bin号码。我只是不确定增加它的正确方法。感谢您的建议和意见。递增数组中的值
int binsize = Convert.ToInt32(xrLabel101.Text)/10;//Max divided by 10 to get the size of each bin
this.xrChart4.Series[0].Points.Clear();
int binCount = 10;
for (int i = 0; i < binCount; i++)
{
int m = Convert.ToInt32(xrLabel104.Text);//This is the number of loops needed
string[] binct = new string[10];
for (int k = 0; k < m; k++)
{
int idx = Convert.ToInt32(currentcolumnvalue)/binsize;
binct[idx]++;//I know this is wrong. Suggestions?
}
}
binct的数据类型是什么? – gleng
我创建了数组来保持每个10箱的箱数的数量。它可以只是一个整数。 –
查看Tigran的回答。您正在访问上述代码中索引为'idx'的对象,该对象是一个字符串数组。你不能增加一个字符串数组。我假设你正在尝试用k在for循环中做些什么? –