Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

Just learned from this answer by ciaothis answer by ciao that Downsample is made for this kind of task:

Downsample[#, {1, 2}] & /@ lis1
(* {{{a1, c1, e1}, {a2, c2, e2}}, {{a3, c3, e3}, {a4, c4, e4}}} *)

You can also use Take, Drop and Extract to get the same result:

Take[#, All, {1, -1, 2}] & /@ lis1
Drop[#, {}, {2, -1, 2}] & /@ lis1
First@Rest@Extract[lis1, {{0}, {;; , ;; , ;; ;; 2}}]

You can use arbitrary lists for Part specifications with Part and Extract. For example

#[[All, ;; , {1, 4, 5}]] &@lis1  (* or *)
First@Rest@Extract[lis1, {{0}, {All, ;; , {1, 4, 5}}}]

both give all rows and columns 1, 4 and 5 in all matrices in lis1:

(* {{{a1, d1, e1}, {a2, d2, e2}}, {{a3, d3, e3}, {a4, d4, e4}}} *)

Just learned from this answer by ciao that Downsample is made for this kind of task:

Downsample[#, {1, 2}] & /@ lis1
(* {{{a1, c1, e1}, {a2, c2, e2}}, {{a3, c3, e3}, {a4, c4, e4}}} *)

You can also use Take, Drop and Extract to get the same result:

Take[#, All, {1, -1, 2}] & /@ lis1
Drop[#, {}, {2, -1, 2}] & /@ lis1
First@Rest@Extract[lis1, {{0}, {;; , ;; , ;; ;; 2}}]

You can use arbitrary lists for Part specifications with Part and Extract. For example

#[[All, ;; , {1, 4, 5}]] &@lis1  (* or *)
First@Rest@Extract[lis1, {{0}, {All, ;; , {1, 4, 5}}}]

both give all rows and columns 1, 4 and 5 in all matrices in lis1:

(* {{{a1, d1, e1}, {a2, d2, e2}}, {{a3, d3, e3}, {a4, d4, e4}}} *)

Just learned from this answer by ciao that Downsample is made for this kind of task:

Downsample[#, {1, 2}] & /@ lis1
(* {{{a1, c1, e1}, {a2, c2, e2}}, {{a3, c3, e3}, {a4, c4, e4}}} *)

You can also use Take, Drop and Extract to get the same result:

Take[#, All, {1, -1, 2}] & /@ lis1
Drop[#, {}, {2, -1, 2}] & /@ lis1
First@Rest@Extract[lis1, {{0}, {;; , ;; , ;; ;; 2}}]

You can use arbitrary lists for Part specifications with Part and Extract. For example

#[[All, ;; , {1, 4, 5}]] &@lis1  (* or *)
First@Rest@Extract[lis1, {{0}, {All, ;; , {1, 4, 5}}}]

both give all rows and columns 1, 4 and 5 in all matrices in lis1:

(* {{{a1, d1, e1}, {a2, d2, e2}}, {{a3, d3, e3}, {a4, d4, e4}}} *)
added 64 characters in body
Source Link
chris
  • 23.1k
  • 5
  • 62
  • 151

Just learned from this answer by ciao that DownsampleDownsample is made for this kind of task:

Downsample[#, {1, 2}] & /@ lis1
(* {{{a1, c1, e1}, {a2, c2, e2}}, {{a3, c3, e3}, {a4, c4, e4}}} *)

You can also use Take, Drop and Extract to get the same result:

Take[#, All, {1, -1, 2}] & /@ lis1
Drop[#, {}, {2, -1, 2}] & /@ lis1
First@Rest@Extract[lis1, {{0}, {;; , ;; , ;; ;; 2}}]

You can use arbitrary lists for Part specifications with Part and Extract. For example

#[[All, ;; , {1, 4, 5}]] &@lis1  (* or *)
First@Rest@Extract[lis1, {{0}, {All, ;; , {1, 4, 5}}}]

both give all rows and columns 1, 4 and 5 in all matrices in lis1:

(* {{{a1, d1, e1}, {a2, d2, e2}}, {{a3, d3, e3}, {a4, d4, e4}}} *)

Just learned from this answer by ciao that Downsample is made for this kind of task:

Downsample[#, {1, 2}] & /@ lis1
(* {{{a1, c1, e1}, {a2, c2, e2}}, {{a3, c3, e3}, {a4, c4, e4}}} *)

You can also use Take, Drop and Extract to get the same result:

Take[#, All, {1, -1, 2}] & /@ lis1
Drop[#, {}, {2, -1, 2}] & /@ lis1
First@Rest@Extract[lis1, {{0}, {;; , ;; , ;; ;; 2}}]

You can use arbitrary lists for Part specifications with Part and Extract. For example

#[[All, ;; , {1, 4, 5}]] &@lis1  (* or *)
First@Rest@Extract[lis1, {{0}, {All, ;; , {1, 4, 5}}}]

both give all rows and columns 1, 4 and 5 in all matrices in lis1:

(* {{{a1, d1, e1}, {a2, d2, e2}}, {{a3, d3, e3}, {a4, d4, e4}}} *)

Just learned from this answer by ciao that Downsample is made for this kind of task:

Downsample[#, {1, 2}] & /@ lis1
(* {{{a1, c1, e1}, {a2, c2, e2}}, {{a3, c3, e3}, {a4, c4, e4}}} *)

You can also use Take, Drop and Extract to get the same result:

Take[#, All, {1, -1, 2}] & /@ lis1
Drop[#, {}, {2, -1, 2}] & /@ lis1
First@Rest@Extract[lis1, {{0}, {;; , ;; , ;; ;; 2}}]

You can use arbitrary lists for Part specifications with Part and Extract. For example

#[[All, ;; , {1, 4, 5}]] &@lis1  (* or *)
First@Rest@Extract[lis1, {{0}, {All, ;; , {1, 4, 5}}}]

both give all rows and columns 1, 4 and 5 in all matrices in lis1:

(* {{{a1, d1, e1}, {a2, d2, e2}}, {{a3, d3, e3}, {a4, d4, e4}}} *)
added 69 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929

Just learned from this answer by ciao that Downsample is made for this kind of task:

Downsample[#, {1, 2}] & /@ lis1
(* {{{a1, c1, e1}, {a2, c2, e2}}, {{a3, c3, e3}, {a4, c4, e4}}} *)

You can also use Take, Drop and Extract to get the same result:

Take[#, All, {1, -1, 2}] & /@ lis1
Drop[#, {}, {2, -1, 2}] & /@ lis1
First@Rest@Extract[lis1, {{0}, {;; , ;; , ;; ;; 2}}]

You can use arbitrary lists for Part specifications with Part and Extract. For example

#[[All, ;; , {1, 4, 5}]] &@lis1  (* or *)
First@Rest@Extract[lis1, {{0}, {All, ;; , {1, 4, 5}}}]

both give all rows and columns 1, 4 and 5 in all matrices in lis1:

(* {{{a1, d1, e1}, {a2, d2, e2}}, {{a3, d3, e3}, {a4, d4, e4}}} *)

Just learned from this answer by ciao that Downsample is made for this kind of task:

Downsample[#, {1, 2}] & /@ lis1
(* {{{a1, c1, e1}, {a2, c2, e2}}, {{a3, c3, e3}, {a4, c4, e4}}} *)

You can also use Take, Drop and Extract to get the same result:

Take[#, All, {1, -1, 2}] & /@ lis1
Drop[#, {}, {2, -1, 2}] & /@ lis1
First@Rest@Extract[lis1, {{0}, {;; , ;; , ;; ;; 2}}]

Just learned from this answer by ciao that Downsample is made for this kind of task:

Downsample[#, {1, 2}] & /@ lis1
(* {{{a1, c1, e1}, {a2, c2, e2}}, {{a3, c3, e3}, {a4, c4, e4}}} *)

You can also use Take, Drop and Extract to get the same result:

Take[#, All, {1, -1, 2}] & /@ lis1
Drop[#, {}, {2, -1, 2}] & /@ lis1
First@Rest@Extract[lis1, {{0}, {;; , ;; , ;; ;; 2}}]

You can use arbitrary lists for Part specifications with Part and Extract. For example

#[[All, ;; , {1, 4, 5}]] &@lis1  (* or *)
First@Rest@Extract[lis1, {{0}, {All, ;; , {1, 4, 5}}}]

both give all rows and columns 1, 4 and 5 in all matrices in lis1:

(* {{{a1, d1, e1}, {a2, d2, e2}}, {{a3, d3, e3}, {a4, d4, e4}}} *)
added 69 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
added 148 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading