逐句翻译这段代码if (board_channel_number == 2) { int cnt0 = 0; for (int j = spos*4; cnt0 < cnt && j + 3 < netBuffer.size(); j += 4,cnt0++) { y[0].push_back(static_cast<double>(((netBuffer[j + 0] & 0xFF) | (netBuffer[j + 1] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); // //(rand()%300); y[1].push_back(static_cast<double>(((netBuffer[j + 2] & 0xFF) | (netBuffer[j + 3] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); //(rand()%500) } cnt = cnt0; } else if (board_channel_number == MAX_CHANNEL) { int cnt0 = 0; for (int j = spos*12;cnt0<cnt&& j + 11 < netBuffer.size(); j += 12,cnt0++) { y[0].push_back(static_cast<double>((netBuffer[j + 0] & 0xFF | (netBuffer[j + 1] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); // //(rand()%300); y[1].push_back(static_cast<double>((netBuffer[j + 2] & 0xFF | (netBuffer[j + 3] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); //(rand()%500); y[2].push_back(static_cast<double>((netBuffer[j + 4] & 0xFF | (netBuffer[j + 5] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); y[3].push_back(static_cast<double>((netBuffer[j + 6] & 0xFF | (netBuffer[j + 7] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); y[4].push_back(static_cast<double>((netBuffer[j + 8] & 0xFF | (netBuffer[j + 9] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); y[5].push_back(static_cast<double>((netBuffer[j + 10] & 0xFF | (netBuffer[j + 11] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); } cnt = cnt0; } x.resize(y[0].size()); for (size_t i = 0; i < x.size(); i++) { x[i] = i+spos; } for (size_t i = 0; i < board_channel_number; i++) { newWin->graph(i)->setData(x, y[i]); newWin->graph(i)->setPen(QPen(color[i])); } newWin->replot(QCustomPlot::rpQueuedReplot); }
时间: 2024-04-10 15:30:43 浏览: 77
60_binary_counter_vhdl_quartus2.rar_cnt exp_quartus 60进制_quartus
如果(board_channel_number == 2)
{
int cnt0 = 0;
for (int j = spos*4; cnt0 < cnt && j + 3 < netBuffer.size(); j += 4,cnt0++)
{
y[0].push_back(static_cast<double>(((netBuffer[j + 0] & 0xFF) | (netBuffer[j + 1] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); // //(rand()%300);
y[1].push_back(static_cast<double>(((netBuffer[j + 2] & 0xFF) | (netBuffer[j + 3] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); //(rand()%500)
}
cnt = cnt0;
}
else if (board_channel_number == MAX_CHANNEL)
{
int cnt0 = 0;
for (int j = spos*12;cnt0<cnt&& j + 11 < netBuffer.size(); j += 12,cnt0++) {
y[0].push_back(static_cast<double>((netBuffer[j + 0] & 0xFF | (netBuffer[j + 1] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); // //(rand()%300);
y[1].push_back(static_cast<double>((netBuffer[j + 2] & 0xFF | (netBuffer[j + 3] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution))); //(rand()%500);
y[2].push_back(static_cast<double>((netBuffer[j + 4] & 0xFF | (netBuffer[j + 5] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution)));
y[3].push_back(static_cast<double>((netBuffer[j + 6] & 0xFF | (netBuffer[j + 7] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution)));
y[4].push_back(static_cast<double>((netBuffer[j + 8] & 0xFF | (netBuffer[j + 9] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution)));
y[5].push_back(static_cast<double>((netBuffer[j + 10] & 0xFF | (netBuffer[j + 11] << 8)) * board_input_range[0] * 2 / qPow(2, board_resolution)));
}
cnt = cnt0;
}
x.resize(y[0].size());
for (size_t i = 0; i < x.size(); i++)
{
x[i] = i+spos;
}
for (size_t i = 0; i < board_channel_number; i++)
{
newWin->graph(i)->setData(x, y[i]);
newWin->graph(i)->setPen(QPen(color[i]));
}
newWin->replot(QCustomPlot::rpQueuedReplot);
阅读全文