Filter löschen
Filter löschen

How to apply at each cell a division

2 Ansichten (letzte 30 Tage)
Stefano Alberti
Stefano Alberti am 15 Feb. 2016
Kommentiert: dpb am 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 Kommentare
Stefano Alberti
Stefano Alberti am 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 am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by