image thumbnail

Find the "I J K" indices of any element number "e" in the 2D or 3D matrix

version 1.2.0.0 (1.84 KB) by sunil anandatheertha
Many a times it may be required to identify the indices, 'i','j' and 'k' values of an element number

289 Downloads

Updated 14 Feb 2012

View License

Many a times it may be required to identify the indices, 'i'(row),'j'(column) and 'k'(plane) values of an element number 'e'

% SAMPLE USAGE 1
% [row,column,plane]=findijk(79,[10 10 10])
% row =
% 9
% column =
% 8
% plane =
% 1
% SAMPLE USAGE 2
% [row,column,plane]=findijk(79,[10 10])
% row =
% 9
% column =
% 8
% plane =
% 1
% SAMPLE USAGE 3
% [row,column,plane]=findijk(301,[10 10 10])
% row =
% 1
% column =
% 1
% plane =
% 4

[NOTE: Its just another method and users who are inquisitive enough to know a different approach (as with the inbuilt function ind2sub) to do the same job, would find this interesting.]

Cite As

sunil anandatheertha (2021). Find the "I J K" indices of any element number "e" in the 2D or 3D matrix (https://www.mathworks.com/matlabcentral/fileexchange/34824-find-the-i-j-k-indices-of-any-element-number-e-in-the-2d-or-3d-matrix), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories

Community Treasure Hunt

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

Start Hunting!