How to change the sample time?

14 views (last 30 days)
sewook
sewook on 5 Dec 2012
Hello,
Only I want is recording a data to workspace with scope.
There is data like below (from workspace):
[t , v]
0.0 , 4.5
0.1 , 4.45
0.2 , 4.43
0.3 , 4.3
... , ...
10.0 , 4.0
20.0 , 4.1
30.0 , 4.15
..., ...
10000.0 , 4.2
A sampling time of part of data has a value per 0.1sec, the other part has a value per 10sec. (it can be larger than 10sec)
After some calculation, I wolud like to record this data using a scope. But I can set only one sampling time value in the scope parameter. TT
If I set the sampling time 0.1sec, the data is too much, and if I set the sampling time 10sec, the 0.1sec data are gone.
Accoring to input(from workspace block), I would like to change the sampling time. is it possible? or how can I fix this problems...?
  2 Comments
Azzi Abdelmalek
Azzi Abdelmalek on 5 Dec 2012
It's not clear, you have data from workspace, and you want to export those data to workspace!
sewook
sewook on 6 Dec 2012
My purpose is comparing original data and simulated data, so the sampling time should be matched. Thank you for your advice. In case of long data, I should find another methoad about it.

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 5 Dec 2012
For each signal use one scope with it's sample time
  2 Comments
sewook
sewook on 6 Dec 2012
there is only one signal. The signal has different sample time like above.(some signal has 0.1sec sample time, some signal has 10sec sample time.)
Azzi Abdelmalek
Azzi Abdelmalek on 6 Dec 2012
Ok, then don't use sample time in your scope, let sampling option on decimation

Sign in to comment.

More Answers (1)

TAB
TAB on 6 Dec 2012
Edited: TAB on 6 Dec 2012
It is not possible to log the same signal with different sample time. For your case use lowest sample time (0.1 sec) to log the scope data. From the logged data you can extract the values at sample times you need.
For example ScopeData is the variable logged by scope. You can extract your values as
Myt1 = [0.0:0.1:0.3]';
Myt2 = [10:10:1000]';
[~, Idx1, ~] = intersect(ScopeData.time,Myt1);
[~, Idx2, ~] = intersect(ScopeData.time,Myt2);
MyValues = [ScopeData.signals.values(Idx1) ; ScopeData.signals.values(Idx2)];

Products

Community Treasure Hunt

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

Start Hunting!