How do you make an input variable name = ' : ' ?
이전 댓글 표시
How do you make an input variable name = ' : ' in order to use the input name to access values in a (m x n x 3) uint8 array?
function [ new ] = array( row, col )
new(:,col,:) = []; % this only works if there are 2 :
the input variable is Row but it needs to be : so that i can delete this number in the array.
댓글 수: 2
James Tursa
2015년 9월 1일
편집: James Tursa
2015년 9월 1일
Please provide a short example, in pseudo-code if needed, of what you would like to do. E.g., give the variables you start with, and the result you are looking for. A string variable can hold ':' of course, but that can't be the actual name of a variable.
Maia Wati-Cooper
2015년 9월 1일
채택된 답변
추가 답변 (1개)
Image Analyst
2015년 9월 1일
1 개 추천
You can't have a function that deletes a column from all planes of a 3D array if you don't pass in the array! In your function called array (a bad name in my opinion), you try to delete the column indicated by "col" from an array called "new" yet "new" does not even exist yet! Obviously, "new" must exist before you can delete things from it.
And that would not delete a number - it would delete a slice. Imagine that you have a 3D array that is a color RGB image where the indexes are (row, column, colorChannel). So you're saying to delete all rows and all colors of a particular column. So if your array was 480 rows tall by 640 columns wide, by 3 color planes high, and you wanted to delete column 42, you'd have like a vertical slice of 480 rows tall by 3 color planes high at column 42. So you'd be removing that 480 by 3 slice of values from the 3D array. That is a bunch of values, not just one value. And, like I said, that 3D array has to exist first before you can delete anything from it.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!