Empty_Matrix

di Anonimizzato16754 il
3 risposte
Buongiorno a tutti
Ho pregettato un algoritmo iterativo che ogni tanto mi dà questo tipo di errore: "Empty matrix: 1-by-0"
Ora vorrei creare un ciclo if che, nel caso la mia variabile risulti appunto vuota, assegni un valore da me prestabilito
Qualche idea?

Grazie a tutti

3 Risposte

  • Per testare se un vettore o una matrice è vuota, puoi usare la funzione

    isempty
    >> help isempty
    isempty True for empty array.
    isempty(X) returns 1 if X is an empty array and 0 otherwise. An
    empty array has no elements, that is prod(size(X))==0.
    Hope this helps.

    P. S.: sei riuscita a risolvere il problema del "Controllo del tipo di variabile"? (http://www.iprogrammatori.it/forum-programmazione/matlab-simulink/controllo-tipo-variabile-t24534.html#p8537534
  • Grazie ancora. Se fossi stata più attenta l'avrei dedotta dall'altra risposta
  • Non sei stata "disattenta"
    Nella risposta precedete non c'era nessun riferimento alla funzione "isempty".

    Per informazione, il comando "help strfun" dato dalla Command Window restituisce l'elenco di tutte le funzioni che gestiscono le stringhe.

    Hope this helps.
Devi accedere o registrarti per scrivere nel forum
3 risposte