Input combination of string and number to a function which only accepts numbers?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Martin Randau
il 15 Lug 2021
Commentato: Martin Randau
il 15 Lug 2021
I am using EEGLAB on Matlab and would like to cut sections of the EEG between blocks. In EEGLAB the function is pop_select which accepts numbers separated by semicolon, e.g. [0 100; 120 150; 160 170], to select e.g. the period from 0 to 100 ms, etc.
I would like to create this input as an array, input_array, which is fed directly to the function, e.g. pop_select( EEG, 'notime', input_array), since I don't know beforehand which time periods I want to select.
However, the input must be separated by semicolon, which means that input_array contains strings and cannot be converted to a number array. Is there a way to overcome this?
2 Commenti
Rik
il 15 Lug 2021
How exactly does that mean input_array contains strings?
I only see a 3x2 numeric array.
[0 100; 120 150; 160 170]
Risposta accettata
Cris LaPierre
il 15 Lug 2021
MATLAB uses semicolons to construct arrays. A semicolon represents the end of a row. Anything following it is placed on the next row.
9 Commenti
Cris LaPierre
il 15 Lug 2021
Incidentally, that produces exactly the same result as this code I shared earlier:
input_array = [EEG.xmin boundaryEnd_sec(2:end); boundaryStart_sec(2:end) EEG.xmax]';
EEG = pop_select( EEG, 'notime', input_array)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su EEG/MEG/ECoG in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!