Arithmetic division for cell array

조회 수: 13 (최근 30일)
Sherif Shokry
Sherif Shokry 2017년 12월 20일
댓글: Sherif Shokry 2017년 12월 20일
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일
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일
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개)

Sherif Shokry
Sherif Shokry 2017년 12월 20일

카테고리

Help CenterFile Exchange에서 .NET Data Types in MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by