I have 2 cell arrays (same dimensions). How can I divide only the variables in the 2nd array in the 1st cell array over the 2nd array in the 2nd cell array
veh_speeds = vis.Net.Vehicles.GetMultiAttValues('Speed'); % 203x2 cell
veh_positions = vis.Net.Vehicles.GetMultiAttValues('Pos'); % 203x2 cell

4 件のコメント

James Tursa
James Tursa 2017 年 12 月 20 日
Can you please provide a short example of the cells and what exactly you want for a result?
Sherif Shokry
Sherif Shokry 2017 年 12 月 20 日
this pdf file contains the 2 cell arrays I need to divide their variables
James Tursa
James Tursa 2017 年 12 月 20 日
Many of us do not want to open a pdf file. Please post text showing a small sample of cell arrays and then list exactly what you would want for a result.
Sherif Shokry
Sherif Shokry 2017 年 12 月 20 日
veh_speeds = vis.Net.Vehicles.GetMultiAttValues('Speed'); veh_positions = vis.Net.Vehicles.GetMultiAttValues('Pos');
the result that I want: greenTime = (veh_positions(:,2))./(veh_speeds(:,2));
however the I have an error: "Undefined operator '/' for input arguments of type 'cell'."

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

 採用された回答

Birdman
Birdman 2017 年 12 月 20 日

0 投票

Pos=cell2mat(veh_positions(:,2));
Vel=cell2mat(veh_speeds(:,2));
Result=Pos./Vel

1 件のコメント

Sherif Shokry
Sherif Shokry 2017 年 12 月 20 日
Thank you so much (Mr. Birdman), it works now

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

その他の回答 (1 件)

カテゴリ

タグ

質問済み:

2017 年 12 月 20 日

コメント済み:

2017 年 12 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by