middleAsColumn: Return all but first and last element as a column vector - MATLAB Cody - MATLAB Central

Problem 584. middleAsColumn: Return all but first and last element as a column vector

Difficulty:Rate

Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first should be singleton.)

For example,

>> middleAsColumn(eye(3))
ans =
   0
   0
   0
   1
   0
   0
   0

Solution Stats

28.59% Correct | 71.41% Incorrect
Last Solution submitted on Jun 04, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
3
6

Problem Recent Solvers615

Suggested Problems

More from this Author11

Problem Tags

Community Treasure Hunt

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

Start Hunting!