- using fullfile is much better than concatenating the filepath and filename.
- You should load your data into a variable, rather than directly into the workspace. This then also makes it trivial to create a non-scalar structure directly in a loop when the data is loaded.
- load the data first (into a non-scalar structure), then rearrange it, if required.
How to load my MAT files into a structure
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am looking to write a code where the Mat files I import are stacked together. I have started the code like this:
prompt = {'Enter Number of therapists','Enter number of trials' };
dlg_title = 'Input Report Information';
num_lines = 1;
Input = inputdlg(prompt,dlg_title,num_lines);
Therapist_number = char(Input(1));
Trial_number = char(Input(2));
I would like to open the file with the number of therapists listed and then have the number of trials underneath it.
Previously I have used a code which stacked my data but now I would like it stacked in relation to the input number of therapists and trial number. This old section of code is written with a specific number of inputs.
cd(pname)
[filename, pathname, ~] = uigetfile( ...
{ '*.mat','mat-files (*.mat)'}, ...
'Select condition one mat file');
load([pathname filename])
COND_DATE = filename(8:19);
Condition_1 = COND_DATE(1:4);
Condition_1_YEAR = COND_DATE(5:8);
All mat files have a similar title 'COND_DATE' and I have uploaded a sample Mat file. I would like all my data stacked under the 'MEAN' and 'SD' headings. So it will be: MEAN > Therapist 1 > Trial 1 > Trial 2 > Therapist 2 > Trial 1 > Trial 2 * with the possibility to have more therapists & trials depending on the input
1 comentario
Stephen23
el 10 de Abr. de 2017
Editada: Stephen23
el 10 de Abr. de 2017
Some comments:
Respuestas (0)
Ver también
Categorías
Más información sobre Variables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!