我在Vector of vector中保存了一些数据
Vector<Vector<String>> dataList=
new Vector<Vector<String>>();
我需要在JTable中显示数据,但问题是当我使用Iterator时:
Iterator it=dataList.iterator();
没有next()或hasNext()方法。 我试图施放Iterator但是id没有帮助...... 我尝试了2个前进循环,但我又遇到了问题
for(Vector<String> v : dataList) {
for(String s: v) {
tableMod.addRow(v.get(s));
}
}
但我又有问题,因为方法get()需要int参数... 请给mi一些有用的解决方案 亲切的问候
答案 0 :(得分:0)
应该是:
for(Vector<String> v : dataList) {
tableMod.addRow(v);
}
答案 1 :(得分:0)
UPDATE! 我必须通过串口从Arduino do Java发送结果并在表格中显示它们。我在那里发布了我在java程序中获得的结果图像以及Arduino和Java中的代码
我的Arduino代码:
In [13]: %timeit (x == 35).view(np.uint8)
20.1 ms ± 93.2 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
In [15]: %timeit np.isin(x, 35).view(np.uint8)
30.2 ms ± 1.16 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
我的Java代码:
#define pinPWM 6
#define analogPinIn A0
#define analogPinOut A1
const int r = 68;
const int R = 470;
int valAnalogPinIn;
int valAnalogPinOut;
int Udig[10]={120,135,150,165,180,195,210,225,240,255};
int voltageDigi,ii=0;
int noMeasuring=30;
float voltageIn;
float voltageOut;
float avrVoltageIn;
float avrVoltageOut;
float U;
void setup() {
pinMode(pinPWM,OUTPUT);
Serial.begin(9600);
}
void loop() {
int br=0;
float Uin, Uout, Ia;
while(ii<=10-1){
analogWrite(pinPWM,Udig[ii]);
Serial.print(Udig[ii]);
Uin=measurUin();
Uout=measurUout();
U=Uin-Uout;
Ia=U/r;
Serial.print(",");
Serial.print(Uin);
Serial.print(",");
Serial.print(Uout);
Serial.println();
ii=ii+1;
delay(1);
}
}
float measurUin(){
long sumVoltageIn=0;
for(int i=1;i<=noMeasuring;i++){
valAnalogPinIn=analogRead(analogPinIn);
sumVoltageIn=sumVoltageIn+valAnalogPinIn;
delay(1);
}
avrVoltageIn=sumVoltageIn/noMeasuring;
avrVoltageIn=avrVoltageIn*(5.0/1024);
return avrVoltageIn;
}
float measurUout(){
long sumVoltageOut=0;
for(int i=1;i<=noMeasuring;i++){
valAnalogPinOut=analogRead(analogPinOut);
sumVoltageOut=sumVoltageOut+valAnalogPinOut;
delay(1);
}
avrVoltageOut=sumVoltageOut/noMeasuring;
avrVoltageOut=avrVoltageOut*(5.0/1024);
return avrVoltageOut;
}