function [ outmat ] = reshape3Dto2Dalong3( inmat ) %RESHAPE3DTO2DALONG3 Summary of this function goes here % Detailed explanation goes here % A(:,:,1)=[1:5;6:10;11:15;16:20]; % A(:,:,2)=[21:25;26:30;31:35;36:40]; % A(:,:,3)=[41:45;46:50;51:55;56:60]; % inmat=A; [l1,l2,l3]=size(inmat); outmat=reshape(permute(inmat,[1,3,2]),l1*l3,l2); end