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!