matlab
@jim_thompson5910
snow_depth1 = Columns 1 through 21 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 Columns 22 through 42 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 Columns 43 through 61 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 snow_depth2 = Columns 1 through 21 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 Columns 22 through 42 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 Columns 43 through 59 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 winter13_14_sd = Columns 1 through 21 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 Columns 22 through 42 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 Columns 43 through 63 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 Columns 64 through 84 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 Columns 85 through 105 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 Columns 106 through 120 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
can you attach your m file for me? I want to try it out on my end
thanks
ok so I forgot that the find function spits out the indices
let me fix
% get snow depth snow_depth = gcdata2(:,5); % find the snow depth data in nov 2013 and dec 2013 snow_depth_indices1 = find(year == 2013 & (month == 11 | month == 12)); snow_depth1 = snow_depth(snow_depth_indices1); % find the snow depth data in jan and feb 2014 snow_depth_indices2= find(year == 2014 & (month == 1 | month == 2)); snow_depth2 = snow_depth(snow_depth_indices2); % combine the two snow depths winter13_14_sd = [snow_depth1' snow_depth2'];
now I need to use plotyy right?
you do the same for the snowfall data, then you use plotyy
working and thinking
change `winter13_14_sd` to `winter13_14_sf`
% get snowfall depth snow_fall = gcdata(:,6); % find the snowfall data snow_fall_indices1 = find(year == 2013 & (month == 11 | month == 2)); snow_fall_1 = snow_fall(snow_fall_indices1); % find the snowfall data snow_fall_indices2= find(year == 2014 & (month == 1 | month == 2)); snow_fall_2 = snow_fall(snow_fall_indices2); % combine the two snowfalls winter13_14_sf = [snow_fall_1' snow_fall_2'];
better
hmm strange, the winter13_14_sf variable has 3 less items than winter13_14_sd
you used the wrong data matrix to get the snowfall you should use gcdata2
wow... I always do that... lol
they all look the same so I don't blame you
for some reason, it's kicking out 0 values
hmm maybe not, but I'm still coming up with 117 vs 120
winter13_14_sf should have 120 values in it, but for some reason, it only has 117
hmmmm
oh I see what went wrong you wrote `snow_fall_indices1 = find(year == 2013 & (month == 11 | month == 2));` when it should be `snow_fall_indices1 = find(year == 2013 & (month == 11 | month == 12));`
so you were pulling feb and nov 2013 data
okay, so from here on out I can use plotyy ?
yes
you'll have [1:1:120] as the x vector to represent day 1 through 120 (nov 1st through feb 28th) the y values will differ for the 2 data sets see the figure at the top of page 4
thinking
so my y values are winter13_14_sf and winter12_14_sd ?
correct
plotyy([1:1:120], winter13_14_sd, [1:1:120], winter13_14_sf);
yeah that should work
so i suppressed the previous plots. When I run the code it displays four subplots, the 4th one displaying two graphs in one box.
that's not supposed to happen hmm
you need to create an entire new figure for the new plot
plotyy([1:1:120], winter13_14_sd, [1:1:120], winter13_14_sf); so it looks like it works when I suppress the previous subplots
let me attach an image
I'm not sure how to make a new figure, so I guess the best way to do it is to break it up into different cells. Cell 1 has figure 1, cell 2 with figure 2, etc etc
okay
but the graph you posted looks good
Join our real-time social learning platform and learn together with your friends!