MATLAB: Create output structure within a function

output structure

Hi,
I have problems getting the data output in a structure. I made a function in which I do several things. In the end, I want to have an output structure which contains different parts of the data.
this is how the script starts: function [output] = interpolate_csv (filename)
In the end I create the output like this: output = struct('pathstr','name','ext','baseline', 'postbaseline','postbaseline_baseline_corrected_0_500ms', 'postbaseline_baseline_corrected_500_1000ms', 'postbaseline_baseline_corrected_1000_1500ms', 'postbaseline_baseline_corrected_1500_2000ms', 'postbaseline_baseline_corrected_2000_2500ms', 'postbaseline_baseline_corrected_2500_3000ms', 'postbaseline_baseline_corrected_3000_3500ms', 'postbaseline_baseline_corrected_3500_4000ms')
All I get is this:
output =
''
What do I need to add to the script?
Thank you for your help.
best, Mariska

Best Answer

unless you mean this:
output = struct('pathstr','name','ext','baseline', 'postbaseline',{'postbaseline_baseline_corrected_0_500ms', 'postbaseline_baseline_corrected_500_1000ms', 'postbaseline_baseline_corrected_1000_1500ms', 'postbaseline_baseline_corrected_1500_2000ms', 'postbaseline_baseline_corrected_2000_2500ms', 'postbaseline_baseline_corrected_2500_3000ms', 'postbaseline_baseline_corrected_3000_3500ms', 'postbaseline_baseline_corrected_3500_4000ms'})
output =
1x8 struct array with fields:
pathstr
ext
postbaseline
>> output(1)
ans =
pathstr: 'name'
ext: 'baseline'
postbaseline: 'postbaseline_baseline_corrected_0_500ms'