Effacer les filtres
Effacer les filtres

How to bring in a single channel EEG signal from MATLAB workspace into Simulink?

6 vues (au cours des 30 derniers jours)
Tania Akhtar
Tania Akhtar le 13 Mai 2024
Modifié(e) : Tania Akhtar le 15 Mai 2024 à 14:17
I've been trying to bring an EEG signal into simulink that is made up of a single column, but it says I cannot use neither signal from workspace nor From work space block due to it not having a second channel (time related). Is there any other way to import the signal? I've tried inputting it as {t,data] but it still doesn't work. My time was as follows:
t=0:1/256:40 %256 is the fs, and 40 is the signal duration in seconds
The data is a single channel eeg data, it is a column with 10240 values (256Hz * 40secs).

Réponses (2)

Shivani
Shivani le 13 Mai 2024
Hi Tania,
After generating the value in variable “t” at my end, it is my understanding that it is a matrix of dimension 1*1024. This means that there are 1024 columns and 1 row in the matrix. Since your question mentions that the dataset contains only a single column, it is likely that a mismatch in the expected number of rows and columns may be leading to the error encountered.
You can import this data into your Simulink model by utilising the “Simin” block which can be found in “Simulink/Sources”. You can refer to the following MathWorks Documentation link for more details regarding this: https://www.mathworks.com/help/simulink/slref/fromworkspace.html
Additionally, you can also refer to this documentation for more information on loading data from the workspace: https://www.mathworks.com/help/simulink/ug/load-data-using-the-from-workspace-block.html
I hope this helps!
  1 commentaire
Tania Akhtar
Tania Akhtar le 14 Mai 2024
Modifié(e) : Tania Akhtar le 15 Mai 2024 à 14:17
Hello thank you for your answer, I've tried again making sure the dimensions are the same 1x76801 for both, yet I am still having issues. I've read through the documents and tried changing bits based on the pages but i cannot quite figure out the issue yet. I think it could be the block parameters in simulink maybe

Connectez-vous pour commenter.


Walter Roberson
Walter Roberson le 13 Mai 2024
t = (0:length(YOUR_EEG_SIGNAL)-1) / fs .';
SIGNAL = [t, YOUR_EEG_SIGNAL(:)];
assignin('base', 'SIGNAL', SIGNAL);
Now From Workspace asking for SIGNAL
  1 commentaire
Tania Akhtar
Tania Akhtar le 13 Mai 2024
Modifié(e) : Tania Akhtar le 15 Mai 2024 à 14:16
Thank you for your reply, I've tried this and whilst there's less errors it still doesnt seem to work sadly. I had to add t=t' otherwise there was an error that said "Error using horzcat
Dimensions of arrays being concatenated are not consistent." in MATLAB.
and even after I put it into simulink there were still errors.
"Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs."
"Output argument 'data' is not assigned on some execution paths. For code generation, all variables must be fully defined before use"
and a couple more
it could be i'm entering the wrong values into the block but ive tried default and using 300, yet nothing seems to work.

Connectez-vous pour commenter.

Catégories

En savoir plus sur EEG/MEG/ECoG dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by