フィルターのクリア

How to search for specific numbers in a structure with cell matrix

1 回表示 (過去 30 日間)
Herbert Walter
Herbert Walter 2011 年 1 月 31 日
As a matlab beginner I have to deal with some measure data as a celll matrix in a structure(values). The Matrix contains the different values of "Time", "Voltage" etc. I'd like to plot e.g. the voltage over the time only for a specific period, not from the beginning. I already know how to do this by calling indices, but i don't know the indices of the relevant times.
  1 件のコメント
Walter Roberson
Walter Roberson 2011 年 1 月 31 日
We need a small example of your data structure to give you the right command.

サインインしてコメントする。

回答 (1 件)

Martijn
Martijn 2011 年 1 月 31 日
Suppose you have vectors:
t = 1:10;
y = t.^2;
And you want to plot(t,y) where for example 2 < t < 5. You could use the following:
% Find the elements meeting your requirement
ind = (t > 2) & (t < 5);
% Plot only these values
plot(t(ind),y(ind))
Hint: The example above used logical indexing; this should work fine here, if for some reason you need a linear index however you can use the FIND function.
ind_lin = find(ind)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by