- The end function also serves as the last index in an indexing expression. In that context, end is the same as size(X,k) when used as part of the kth index into array X. Examples of this use are X(3:end) to select the third through final elements of the array, and X(1,1:2:end-1) to select all even elements of the first row, excluding the last element. When using end to grow an array, as in X(end+1)=5, make sure X exists first.
Reading data in cell arrays help
2 ビュー (過去 30 日間)
古いコメントを表示
Hi There was this line in a program code.
for k = 1:9
[i,j] = ind2sub([3,3],k);
Output(:,:,indx+k) = AccessImageDiff{row,col}(i:end-3+i,j:end-3+j);
end
Now my problem is how do i read this line? Can somebody teach me on how to read this specific line
- Output(:,:,indx+k) = AccessImageDiff{row,col}(i:end-3+i,j:end-3+j);*
i know that it is accessing a cell array and manipulating its data but what i am confused about is the (i:end-3+i,j:end-3+j) part.
1.what does ":" mean?
2.what does "end" mean? It didn't use end as a variable.
Thanks in advance
There's this tutorial about accessing data in cell arrays but it doesn't really answer my question https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-cell-array.html
0 件のコメント
採用された回答
Star Strider
2017 年 7 月 30 日
‘... what i am confused about is the (i:end-3+i,j:end-3+j) part.’
Here, end is the size of the array in that dimension. See the documentation on end (link) for a full description, specifically:
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!