Problem with generating csv file from logdata
1 view (last 30 days)
Show older comments
I have a model with x insignals and y outsignals which I all log by checking the 'Log signal data' box in Signal Properties/Logging and accessibility. As output I get t.ex. 'logsout.ModelName.signalName'. Now I want to generate a csv file for selected input/output signals in order to use it in other tests.
My problem is that I use different scheduling for different subsystems. This results in different length for the time and data values of the logged signals, lets say length(signal1.Time)= 2000, length(signal2.Time)= 10000, length(signal3.Time)= 20000 and so on. I try to generate a csv file as following:
for i = 1:length(wantedVariables)
try
csvVariables{end+1,1} = evalin('base',char(wantedVariables{i}));
nameVector{end+1,1} = csvVariables{end}.Name;
timeVector(:,end+1) = csvVariables{end}.Time;
dataVector(:,end+1) = csvVariables{end}.Data;
catch
disp('No logdata available')
end
end
logdata = [timeVector, dataVector];
dlmwrite(inputCSVName, logdata, '-append');
This of course does not work since the vectors have different length. Is there a way to do it more simple or do I have to create 'timeVector' and 'dataVector' in a more advanced way?
Thanks in advance
0 Comments
Answers (0)
See Also
Categories
Find more on General Physics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!