How to import and read a large data set, with respect to time?

2 次查看(过去 30 天)
Hi! Diving straight to the question:
Values.mat when loaded into matlab reveals a 1x1 struct. Within which there are following:
Info {1x1 Struct}
X {1x1 Struct}
Y {1x31 Struct}
Description {1x1 Struct}
My data resides in the Y. When i open each struct, there is more data. Although, data of interest is only one of the data set, lets call it DATA.
DATA 1x27048
I know the total simulation time to generate DATA is 27 secs @ 0.001; i.e. each value is generated after 0.001 sec.
I have already seperated the required data from Values.mat into a seperate values_sep.mat.
My intention is to read this data set as per defined time is
TIME----Data
0.001 - value_1
0.002 - value_2 ... 0.00N - value_N.
Whenever i try to read this data in SIMULINK all get is colored lines on the scope. All other methods have also been useless(from workspace, as a 27048x2 (with time)).
Please guide me how to read this data set as per time.
THANK YOU for your patience!!
  2 个评论
Jan
Jan 2014-4-22
Do I understand correctly, that you explain the contents of the "Values.mat" file in detail, but the file, which is actually used, is "values_sep.mat"?
The table like description is not clear: "TIME----Data, 0.001 - value_1, ..." It is clear to you, what this should mean, but we cannot guess it. It is very strange, that trying to read the data produces colored lines. Please post the corresponding code, because we cannot guess the details.
Sheetansh Kaushik
Sheetansh Kaushik 2014-4-29
Values_sep.mat has the data i require (value.mat was the source). Now, i want to read the data as follows:
@time = 0.001 , Data 1
.
.
.
@time = n, Data N.
i.e. when the simulation time is 0.001 Data_1 should be read and so on. I created two seprate files: time and Values_sep
Now when i tried using "From workspace" block, it shows errors of Incorrect dimensions (as this block requires Structure input only).
I use the following code to create the structure,KLPD:
KLPD.time = time;
KLPD.signals.values =Values_sep;
KLPD.signals.dimensions =1;
I hope i am clear this time.
Although this might seem like a deviation from the original question, but i am confident this would have been the suggested path.So we are( i am ) closer to solving the issue.

请先登录,再进行评论。

采纳的回答

A Jenkins
A Jenkins 2014-4-29
As for the 'colored lines' problem, you may have to transpose (') your matricies. To see what I mean, try this:
t = [0:0.2:10]';
x = sin(t);
In the picture below I have imported the same data once as column vectors [t,x], and once as row vectors [t',x']. One plots the sine wave "correctly", and one plots "colored lines" (which is just each time sample value of the data plotted for the duration).
If this doesn't help, perhaps you could attach a representative sample of your data?
  1 个评论
Sheetansh Kaushik
SOLUTION APPLIED AS:
Converted the Input data into Column vectors.
KLPD_val: 27048x1
Time: 27048x1
Created Struct using the following commands:
KLPD.time = Time;
KLPD.signals.values = KLPD_val;
KLPD.signals.dimensions = 1;
Applied the data in simulink using "simin" block.
Thank you for your input and help!!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by