Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
Herbert Walter
Herbert Walter am 31 Jan. 2011
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 Kommentar
Walter Roberson
Walter Roberson am 31 Jan. 2011
We need a small example of your data structure to give you the right command.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Martijn
Martijn am 31 Jan. 2011
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)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by