Reading out rows with for loop

1 回表示 (過去 30 日間)
Martijn Roks
Martijn Roks 2019 年 4 月 14 日
コメント済み: Stephen23 2019 年 4 月 14 日
Hello,
I have a question about how to get the rows seperated from the cell with a for loop. I want the rows from the value Data seperated and each row in a seperat value
So that I get :
Row1 = row 1 from Data
Row2= row 2 from Data
I want that Row1 etc comes to my workspace, so that I can use it later on
Here is the code that I wrote and the problem is with the for loop with j:
clc;
clear all;
board= arduino();
finishup= onCleanup(@() exitprogram(board));
disp('press Ctr-C to exit');
b=0;
for i= 1:1:10
analog= readVoltage (board, 'A0');
writePWMVoltage (board, 'D3', analog);
disp(['analog= ', num2str(analog)]);
pause(1);
A(i)= analog;
b= b+1;
B(i)= b;
end
A= A';
B=B';
handles.Data= table([B],[A]);
Data0= table2cell(handles.Data);
for j=1:1:10
Row(j)= Data0 ((j):(j),:);
end
  1 件のコメント
Stephen23
Stephen23 2019 年 4 月 14 日
@Martijn Roks: please upload your data (as it is stored in MATLAB memory).
"So that I get :"
Row1 = ...
Row2= ...
I wound not recommend naming variables like that. Read this to know why:

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInstrument Control Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by