Extract only part of a data sheet

1 view (last 30 days)
Inês Mendes
Inês Mendes on 23 May 2015
Answered: Star Strider on 23 May 2015
Hi guys!
If i have an interface in which a user chooses a day and month, how do i extract only the data from that date?
Imagine I have: x= ['08-11-2014 07:45' '10-12-2014 08:00' '09-12-2014 08:15' '09-12-2014 08:30'];
and Y=[2 5 6 7]
If the user choose to study November 8th how do i extract only Y=[2].
Can you help?
Thanks!

Answers (1)

Star Strider
Star Strider on 23 May 2015
Using the listdlg and msgbox functions (because I like them), this works:
x= ['08-11-2014 07:45'
'10-12-2014 08:00'
'09-12-2014 08:15'
'09-12-2014 08:30'];
Y= [2
5
6
7];
[dateidx,v] = listdlg('PromptString','Select a date', 'SelectionMode', 'Single', 'ListString',x);
msgbox(sprintf('The value corresponding to %s is %0.2f',x(dateidx,:),Y(dateidx)), 'Result');

Categories

Find more on Language Fundamentals in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!