Clear Filters
Clear Filters

How to apply at each cell a division

2 views (last 30 days)
Stefano Alberti
Stefano Alberti on 15 Feb 2016
Commented: dpb on 15 Feb 2016
Hi, I've a 1500x1500 double cells, I want to apply a division for a number took it from a 4000x1 double cells, and do it in a for cycle.
I wrote a code that open my files from a directory, but I know that I have to use cellfun comand to do that.
Thanks in advance
Stefano
  5 Comments
Stefano Alberti
Stefano Alberti on 15 Feb 2016
I've a 4000 matrix of 1500x1500, and it rappresent a displacement. I've a 1 matrix of 4000x1, and it rappresent the time.
I'd create a matrix with each cells its the resulf ot division of first matrix/first value of second matrix.
e.g.
matrix 1 = 1 2 3
4 5 6
...
matrix 2 = 7
8
9
10
11
12
....
matrios result = 1/7 2/8 3/9
4/10 5/11 6/12
...
Do it in a for cycle for each matrix.
It si possible ?
Thanks
dpb
dpb on 15 Feb 2016
Still, 1500 X 1500 ~= 4000??? (Actually, of course, 1500^2 is much, much larger than 4000.)
As for the element-wise division, for the first N elements of the first it's possible...
M=matrix1.'; % reorient to column major
M4K=M(1:4000); % save first 4K points
matrix2=M4K./matrix2; % do division as illustrated by example
But, still how to treat the 2.246 million other values from the original 2.25M-element 1500-square array would be a mystery.

Sign in to comment.

Answers (0)

Categories

Find more on Linear Algebra in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!