How do you make an input variable name = ' : ' ?
Mostrar comentarios más antiguos
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 comentarios
James Tursa
el 1 de Sept. de 2015
Editada: James Tursa
el 1 de Sept. de 2015
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
el 1 de Sept. de 2015
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 1 de Sept. de 2015
1 voto
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.
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!