MATLAB COMPILER RELEASE NOTES Guia do Utilizador Página 336

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 716
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 335
R2010a
13-18
Programming
Subscripting Into Function Return Values
If you have a function, such as the following, that returns a struct array:
function structOut = getStruct
structOut = struct('fieldA', 5, 'fieldB', 10);
it is no longer valid to access fields of the structure by directly dot indexing the function's
return value, as shown here:
getStruct.fieldA
Instead, you should first assign the returned structure to a variable, and then dot index
the variable:
s = getStruct;
s.fieldA
ans =
5
This type of field access has never been allowed within function code, and this change
causes scripts and command line statements to be in agreement with function rules.
Compatibility Considerations
If you have scripts that employ this type of dot indexing, they will now throw an error.
Replace this unsupported style of dot indexing with the style shown above.
New Constructor for Map Containers
The following command constructs an empty containers.Map object that uses a key
type of kType, and a value type of vType:
M = containers.Map('KeyType', kType, 'ValueType', vType)
See the containers.Map function reference page for more information.
Function Handle Access to Private and Protected Methods
When creating a function handle inside a method of a class, the function is resolved
using the permissions of that method. When MATLAB invokes the function handle,
Vista de página 335
1 2 ... 331 332 333 334 335 336 337 338 339 340 341 ... 715 716

Comentários a estes Manuais

Sem comentários