-
Notifications
You must be signed in to change notification settings - Fork 7
/
SMRTool_v207_win.asv
1132 lines (980 loc) · 46.5 KB
/
SMRTool_v207_win.asv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
function varargout = SMRTool_v207_win(varargin)
% Copyright (C) {2015} {Adrián Riquelme Guill, adririquelme@gmail.com}
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
% SMRTool_v207_win, Copyright (C) 2015 Adrián Riquelme Guill
% SMRTool_v207_win comes with ABSOLUTELY NO WARRANTY.
% This is free software, and you are welcome to redistribute it
% under certain conditions.
% SMRTOOL_V207_WIN MATLAB code for SMRTool_v207_win.fig
% SMRTOOL_V207_WIN, by itself, creates a new SMRTOOL_V207_WIN or raises the existing
% singleton*.
%
% H = SMRTOOL_V207_WIN returns the handle to a new SMRTOOL_V207_WIN or the handle to
% the existing singleton*.
%
% SMRTOOL_V207_WIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in SMRTOOL_V207_WIN.M with the given input arguments.
%
% SMRTOOL_V207_WIN('Property','Value',...) creates a new SMRTOOL_V207_WIN or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before SMRTool_v207_win_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to SMRTool_v207_win_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help SMRTool_v207_win
% Last Modified by GUIDE v2.5 23-Mar-2019 19:31:45
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @SMRTool_v207_win_OpeningFcn, ...
'gui_OutputFcn', @SMRTool_v207_win_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before SMRTool_v207_win is made visible.
function SMRTool_v207_win_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to SMRTool_v207_win (see VARARGIN)
% Choose default command line output for SMRTool_v207_win
handles.output = hObject;
% cargo las imágenes
A = imread('img/insert','bmp');
set(handles.pushbutton_addplane,'cdata',A);
A = imread('img/delete','bmp');
set(handles.pushbutton_removeplane,'cdata',A);
A = imread('img/moveup','bmp');
set(handles.pushbutton_moveup,'cdata',A);
A = imread('img/movedown','bmp');
set(handles.pushbutton_movedown,'cdata',A);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes SMRTool_v207_win wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = SMRTool_v207_win_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function box_rmrb_Callback(hObject, eventdata, handles)
% hObject handle to box_rmrb (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
pushbutton_SMR_Callback(hObject, eventdata, handles);
set(handles.slider_rmrb,'Value',str2double(get(hObject,'String'))/100);
% Hints: get(hObject,'String') returns contents of box_rmrb as text
% str2double(get(hObject,'String')) returns contents of box_rmrb as a double
% --- Executes during object creation, after setting all properties.
function box_rmrb_CreateFcn(hObject, eventdata, handles)
% hObject handle to box_rmrb (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider_rmrb_Callback(hObject, eventdata, handles)
% hObject handle to slider_rmrb (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
rmrb = floor(get(hObject,'Value')*(get(hObject,'Max')-get(hObject,'Min'))*100);
set(handles.box_rmrb,'String',rmrb);
pushbutton_SMR_Callback(hObject, eventdata, handles);
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider_rmrb_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider_rmrb (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function box_alphas_Callback(hObject, eventdata, handles)
% hObject handle to box_alphas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
pushbutton_SMR_Callback(hObject, eventdata, handles);
set(handles.slider_alphas,'Value',str2double(get(hObject,'String'))/359);
% Hints: get(hObject,'String') returns contents of box_alphas as text
% str2double(get(hObject,'String')) returns contents of box_alphas as a double
% --- Executes during object creation, after setting all properties.
function box_alphas_CreateFcn(hObject, eventdata, handles)
% hObject handle to box_alphas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% pushbutton_SMR_Callback(hObject, eventdata, handles);
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider_alphas_Callback(hObject, eventdata, handles)
% hObject handle to slider_alphas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
alphas = floor(get(hObject,'Value')*(get(hObject,'Max')-get(hObject,'Min'))*359);
set(handles.box_alphas,'String',alphas);
pushbutton_SMR_Callback(hObject, eventdata, handles);
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider_alphas_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider_alphas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function box_betas_Callback(hObject, eventdata, handles)
% hObject handle to box_betas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
pushbutton_SMR_Callback(hObject, eventdata, handles);
set(handles.slider_betas,'Value',str2double(get(hObject,'String'))/90);
% Hints: get(hObject,'String') returns contents of box_betas as text
% str2double(get(hObject,'String')) returns contents of box_betas as a double
% --- Executes during object creation, after setting all properties.
function box_betas_CreateFcn(hObject, eventdata, handles)
% hObject handle to box_betas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider_betas_Callback(hObject, eventdata, handles)
% hObject handle to slider_betas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
betas = floor(get(hObject,'Value')*(get(hObject,'Max')-get(hObject,'Min'))*90);
set(handles.box_betas,'String',betas);
pushbutton_SMR_Callback(hObject, eventdata, handles);
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider_betas_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider_betas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function box_betaj_Callback(hObject, eventdata, handles)
% hObject handle to box_betaj (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
pushbutton_SMR_Callback(hObject, eventdata, handles);
set(handles.slider_betaj,'Value',str2double(get(hObject,'String'))/90);
% Hints: get(hObject,'String') returns contents of box_betaj as text
% str2double(get(hObject,'String')) returns contents of box_betaj as a double
% --- Executes during object creation, after setting all properties.
function box_betaj_CreateFcn(hObject, eventdata, handles)
% hObject handle to box_betaj (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% pushbutton_SMR_Callback(hObject, eventdata, handles);
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider_betaj_Callback(hObject, eventdata, handles)
% hObject handle to slider_betaj (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
betaj = floor(get(hObject,'Value')*(get(hObject,'Max')-get(hObject,'Min'))*90);
set(handles.box_betaj,'String',betaj);
pushbutton_SMR_Callback(hObject, eventdata, handles);
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider_betaj_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider_betaj (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function box_alphaj_Callback(hObject, eventdata, handles)
% hObject handle to box_alphaj (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
pushbutton_SMR_Callback(hObject, eventdata, handles);
set(handles.slider_alphaj,'Value',str2double(get(hObject,'String'))/359);
% Hints: get(hObject,'String') returns contents of box_alphaj as text
% str2double(get(hObject,'String')) returns contents of box_alphaj as a double
% --- Executes during object creation, after setting all properties.
function box_alphaj_CreateFcn(hObject, eventdata, handles)
% hObject handle to box_alphaj (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% pushbutton_SMR_Callback(hObject, eventdata, handles);
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider_alphaj_Callback(hObject, eventdata, handles)
% hObject handle to slider_alphaj (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
alphaj = floor(get(hObject,'Value')*(get(hObject,'Max')-get(hObject,'Min'))*359);
set(handles.box_alphaj,'String',alphaj);
pushbutton_SMR_Callback(hObject, eventdata, handles);
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider_alphaj_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider_alphaj (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to box_betas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of box_betas as text
% str2double(get(hObject,'String')) returns contents of box_betas as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to box_betas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider5_Callback(hObject, eventdata, handles)
% hObject handle to slider_betas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider5_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider_betas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to box_alphas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of box_alphas as text
% str2double(get(hObject,'String')) returns contents of box_alphas as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to box_alphas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on slider movement.
function slider6_Callback(hObject, eventdata, handles)
% hObject handle to slider_alphas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider6_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider_alphas (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on button press in pushbutton_SMR.
function pushbutton_SMR_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_SMR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Primero tomo los datos
RMRb = str2double(get(handles.box_rmrb,'String'));
alphas = str2double(get(handles.box_alphas,'String'));
betas =str2double(get(handles.box_betas,'String'));
alphaj=str2double(get(handles.box_alphaj,'String'));
betaj = str2double(get(handles.box_betaj,'String'));
% calculo los ángulos auxiliares
[ Acoeff1 ] = f_Acoeff1( alphas, alphaj );
[ Ccoeff3 ] = f_Ccoeff3( alphas, alphaj, betas,betaj );
% los pongo en las casillas que toquen
set(handles.text_A,'String',num2str(Acoeff1));
set(handles.text_B,'String',num2str(betaj));
set(handles.text_C,'String',num2str(Ccoeff3));
% calculo los coeficientes
[ coeff1 ] = f_coeff1( alphas, alphaj );
[ coeff1tomas ] = f_coeff1tomas( alphas, alphaj);
[ coeff2 ] = f_coeff2( alphas, alphaj, betaj );
[ coeff2tomas ] = f_coeff2tomas( alphas, alphaj, betaj );
[ coeff3 ] = f_coeff3( alphas, alphaj, betas, betaj );
[ coeff3tomas ] = f_coeff3tomas( alphas, alphaj, betas, betaj );
[ tiporotura ] = f_tiporotura( alphas, alphaj );
F1F2F3Romana = coeff1*coeff2*coeff3;
F1F2F3Tomas = coeff1tomas*coeff2tomas*coeff3tomas;
% los pongo en las casillas correspondientes
set(handles.box_F1,'String',num2str(coeff1));
set(handles.box_F1tomas,'String',num2str(coeff1tomas));
set(handles.box_F2,'String',num2str(coeff2));
set(handles.box_F2tomas,'String',num2str(coeff2tomas));
set(handles.box_F3,'String',num2str(coeff3));
set(handles.box_F3tomas,'String',num2str(coeff3tomas));
set(handles.box_FM,'String',tiporotura);
set(handles.box_F1F2F3Romana,'String',num2str(F1F2F3Romana));
set(handles.box_F1F2F3Tomas,'String',num2str(F1F2F3Tomas));
% calculo el SMR y lo pongo
% redondeo a la parte entera
coeff4 = str2double(get(handles.box_F4,'String'));
SMRRomana = max(0,floor(RMRb + coeff1 * coeff2 * coeff3 + coeff4));
SMRRomana = min(SMRRomana,100);
SMRTomas = max(0,floor(RMRb + coeff1tomas * coeff2tomas * coeff3tomas + coeff4));
SMRTomas = min(SMRTomas, 100);
set(handles.box_SMRRomana,'String',num2str(SMRRomana));
set(handles.box_SMRTomas,'String',num2str(SMRTomas));
% calculo la clasificación para cada uno
[ classsmr, description, stability, failures, support ] = f_classsmr( SMRRomana);
set(handles.box_classromana,'String',classsmr);
set(handles.box_descriptionromana,'String',description);
set(handles.box_stabilityromana,'String',stability);
set(handles.box_failuresromana,'String',failures);
set(handles.box_supportromana,'String',support);
[ classsmr, description, stability, failures, support ] = f_classsmr( SMRTomas);
set(handles.box_classtomas,'String',classsmr);
set(handles.box_descriptiontomas,'String',description);
set(handles.box_stabilitytomas,'String',stability);
set(handles.box_failurestomas,'String',failures);
set(handles.box_supporttomas,'String',support);
% dibujo los gráficos
dibujadipdirections_Callback(hObject, eventdata, handles);
dibujacroquis_Callback(hObject, eventdata, handles);
% --- Executes on selection change in popupmenu_excavation.
function popupmenu_excavation_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu_excavation (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
excavation = get(hObject,'Value');
switch excavation
case 1
F4 = 15;
case 2
F4 = 10;
case 3
F4 = 8;
case 4
F4 = 0;
case 5
F4 = -8;
end
set(handles.box_F4,'String',num2str(F4));
set(handles.box_F4tomas,'String',num2str(F4));
pushbutton_SMR_Callback(hObject, eventdata, handles);
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_excavation contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu_excavation
% --- Executes during object creation, after setting all properties.
function popupmenu_excavation_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu_excavation (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function dibujadipdirections_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_SMR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Primero tomo los datos
alphas = str2double(get(handles.box_alphas,'String'));
alphaj = str2double(get(handles.box_alphaj,'String'));
% dibujo el círculo
theta = 0:0.01:2*pi;
rho = zeros(size(theta));
rho(:) = 1; % Hago el círculo de radio unidad
% dibujamos la figura
cla(handles.axes1,'reset'); %limpio primero la casa
polar(handles.axes1,theta,rho,'--r');
delete(findall(handles.axes1,'type','text'));
% le pongo sus labels
alpha0 = 0:pi/6:(2*pi-pi/12);
alpha = pi/2 - alpha0;
etiqueta = 0:360/12:(330);
x = 1.1*cos(alpha);
y = 1.1*sin(alpha);
[~,n]=size(alpha);
for i=1:n
if etiqueta(i)==0 || etiqueta(i)==pi
text(x(i),y(i),num2str(etiqueta(i)),'HorizontalAlignment','Center');
else
if etiqueta(i)>0 && etiqueta(i)<180
text(x(i),y(i),num2str(etiqueta(i)),'HorizontalAlignment','Left');
else
text(x(i),y(i),num2str(etiqueta(i)),'HorizontalAlignment','Right');
end
end
end
title(handles.axes1,'Dip directions');
hold on;
% dibujo el talud
% Xs=[0 cos(pi/2-alphas/180*pi) -cos(alphas/180*pi) cos(alphas/180*pi)];
% Ys=[0 sin(pi/2-alphas/180*pi) -sin(alphas/180*pi) sin(alphas/180*pi)];
Xs=[0 cos(pi/2-alphas/180*pi)];
Ys=[0 sin(pi/2-alphas/180*pi)];
% dibujo la discontinuidad
Xj=[0 cos(pi/2-alphaj/180*pi)];
Yj=[0 sin(pi/2-alphaj/180*pi)];
g=plot(handles.axes1,Xs,Ys,'b',Xj,Yj,'r');
set(g(1),'LineWidth',1.5);
set(g(2),'LineWidth',1.5);
handles.axes1.Title.Visible='on';
handles.axes1.Title.String=['Dip directions of {\color{blue}slope} and {\color{red}discontinuity}'];
function dibujacroquis_Callback(hObject, eventdata, handles)
% Primero tomo los datos
alphas = str2double(get(handles.box_alphas,'String'));
alphaj=str2double(get(handles.box_alphaj,'String'));
betas = str2double(get(handles.box_betas,'String'));
betaj=str2double(get(handles.box_betaj,'String'));
% determino el talud
H = 10; % altura de representación
xinterseccion = H/tan(betas*pi/180);
Xs=[-H/2 0 xinterseccion (xinterseccion+H/2)];
Ys=[0 0 H H];
xincdisc = H/(2*tan(betaj/180*pi));
alpha=atan(H/(xinterseccion+H))*180/pi;
[ tiporotura ] = f_tiporotura( alphas, alphaj );
% if abs(alphas-alphaj)<90
if tiporotura == 'Wedge/Planar'
if betaj>betas
Xj = [xinterseccion/2 (xinterseccion/2-xincdisc)];
Yj = [H/2 0];
else
if betaj<alpha
Xj=[xinterseccion/2 (xinterseccion+H/2)];
Yj=[H/2 (H/2+(xinterseccion/2+H/2)*tan(betaj/180*pi))];
else
Xj = [xinterseccion/2 (xinterseccion/2+xincdisc)];
Yj = [H/2 H];
end
end
else
if betaj < alpha
Xj=[xinterseccion/2 (xinterseccion+H/2)];
Yj=[H/2 (H/2-(xinterseccion/2+H/2)*tan(betaj/180*pi))];
else
Xj = [xinterseccion/2 (xinterseccion/2+xincdisc)];
Yj = [H/2 0];
end
end
% dibujamos la figura
cla(handles.axes2,'reset'); %limpio primero la casa
g=plot(handles.axes2,Xs,Ys,'b',Xj,Yj,'r');
set(g(1),'LineWidth',1.5);
set(g(2),'LineWidth',1.5);
axis(handles.axes2,'square','equal');
handles.axes2.Title.Visible='on';
handles.axes2.Title.String=['Dip of {\color{blue}slope} and {\color{red}discontinuity}'];
% --- Executes on button press in pushbutton_logoua.
function pushbutton_logoua_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_logoua (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% abro la web de la UA
web('http://www.ua.es/','-browser');
% --- Executes on button press in pushbutton_cc.
function pushbutton_cc_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_cc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton_wedges.
function pushbutton_wedges_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_wedges (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
rmrb=str2double(get(handles.box_rmrb,'String'));
alphas=str2double(get(handles.box_alphas,'String'));
betas=str2double(get(handles.box_betas,'String'));
alphaj=str2double(get(handles.box_alphaj,'String'));
betaj=str2double(get(handles.box_betaj,'String'));
setappdata(0,'global_rmrb',rmrb);
setappdata(0,'global_alphas',alphas);
setappdata(0,'global_betas',betas);
setappdata(0,'global_alphaj',alphaj);
setappdata(0,'global_betaj',betaj);
h = gui_wedgescalculator;
waitfor(h);
walphaj=getappdata(0,'global_walphaj');
wbetaj=getappdata(0,'global_wbetaj');
if isempty(walphaj) || isempty(wbetaj)
% no ha devuelto valor y no hago nada
else
% devuelve valor y lo guardo
set(handles.box_alphaj,'String',num2str(walphaj));
set(handles.box_betaj,'String',num2str(wbetaj));
end
% --- Executes on button press in pushbutton_addplane.
function pushbutton_addplane_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_addplane (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
planes=get(handles.uitable_planes,'Data');
v=[0 0 0 0];
planes=[planes; v];
set(handles.uitable_planes,'Data',planes);
% --- Executes on button press in pushbutton_removeplane.
function pushbutton_removeplane_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_removeplane (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% plano seleccionado
try
planoseleccionado = handles.planoseleccionado;
planos = get(handles.uitable_planes,'Data');
planos (planoseleccionado,:)=[];
set(handles.uitable_planes,'Data',planos);
catch error
% si falla hago esto
end
% --------------------------------------------------------------------
function uipushtool1_ClickedCallback(hObject, eventdata, handles)
% hObject handle to uipushtool1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
gui_about;
% --- Executes during object creation, after setting all properties.
function uitable_slope_CreateFcn(hObject, eventdata, handles)
% hObject handle to uitable_slope (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
v=[134 70];
set(hObject,'Data',v);
% --- Executes during object creation, after setting all properties.
function uitable_planes_CreateFcn(hObject, eventdata, handles)
% hObject handle to uitable_planes (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
v=[322 89 44; 135 26 45; 80 70 47; 124 57 49; 247 77 42];
set(hObject,'Data',v);
% --- Executes during object creation, after setting all properties.
function uitable_wedges_CreateFcn(hObject, eventdata, handles)
% hObject handle to uitable_wedges (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% --- Executes when entered data in editable cell(s) in uitable_planes.
function uitable_planes_CellEditCallback(hObject, eventdata, handles)
% hObject handle to uitable_planes (see GCBO)
% eventdata structure with the following fields (see UITABLE)
% Indices: row and column indices of the cell(s) edited
% PreviousData: previous data for the cell(s) edited
% EditData: string(s) entered by the user
% NewData: EditData or its converted form set on the Data property. Empty if Data was not changed
% Error: error string when failed to convert EditData to appropriate value for Data
% handles structure with handles and user data (see GUIDATA)
try
idplano = eventdata.Indices(1);
slope = get(handles.uitable_slope,'Data');
planes = get(handles.uitable_planes,'Data');
RMRb = planes(idplano,3);
alphas = slope(1,1);
betas = slope(1,2);
alphaj= planes(idplano,1);
betaj = planes(idplano,2);
% calculo los ángulos auxiliares
% [ Acoeff1 ] = f_Acoeff1( alphas, alphaj );
% [ Ccoeff3 ] = f_Ccoeff3( alphas, alphaj, betas,betaj );
% calculo los coeficientes
[ coeff1 ] = f_coeff1( alphas, alphaj );
[ coeff2 ] = f_coeff2( alphas, alphaj, betaj );
[ coeff3 ] = f_coeff3( alphas, alphaj, betas, betaj );
% [ tiporotura ] = f_tiporotura( alphas, alphaj );
% F1F2F3Romana = coeff1*coeff2*coeff3;
% calculo el SMR y lo pongo
% redondeo a la parte entera
coeff4 = str2double(get(handles.box_F4,'String'));
SMRRomana = max(0,floor(RMRb + coeff1 * coeff2 * coeff3 + coeff4));
planes(idplano,4)=SMRRomana;
set(handles.uitable_planes,'Data',planes);
catch error
errordlg(['Error: ' error.identifier]);
set(handles.text_status,'String','Waiting orders ...');
end
% --- Executes when selected cell(s) is changed in uitable_planes.
function uitable_planes_CellSelectionCallback(hObject, eventdata, handles)
% hObject handle to uitable_planes (see GCBO)
% eventdata structure with the following fields (see UITABLE)
% Indices: row and column indices of the cell(s) currently selecteds
% handles structure with handles and user data (see GUIDATA)
% guardo la selección
try
pos=eventdata.Indices(1);
handles.planoseleccionado = pos;
catch error
end
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in pushbutton_moveup.
function pushbutton_moveup_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_moveup (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
planes = get(handles.uitable_planes,'Data');
planoorigen = handles.planoseleccionado;
[n,~]=size(planes);
% preparo los índices de los polos que quiero mover
if planoorigen~=1 && n~=1
planodestino=planoorigen-1;
[planes]=swap(planes,1,planoorigen,planodestino);
% pongo el resultado en la tabla
set(handles.uitable_planes,'Data',planes);
handles.planoseleccionado = planodestino;
end
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in pushbutton_movedown.
function pushbutton_movedown_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_movedown (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
planes = get(handles.uitable_planes,'Data');
planoorigen = handles.planoseleccionado;
[n,~]=size(planes);
% preparo los índices de los polos que quiero mover
if planoorigen~=n && n~=1
planodestino=planoorigen+1;
[planes]=swap(planes,1,planoorigen,planodestino);
% pongo el resultado en la tabla
set(handles.uitable_planes,'Data',planes);
handles.planoseleccionado = planodestino;
end
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in pushbutton_calculatewedges.
function pushbutton_calculatewedges_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_calculatewedges (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
try
% calculo todos los smr por si acaso
slope = get(handles.uitable_slope,'Data');
planes = get(handles.uitable_planes,'Data');
[nplanos,~]=size(planes);
for i=1:nplanos
RMRb = planes(i,3);
alphas = slope(1,1);
betas = slope(1,2);
alphaj= planes(i,1);
betaj = planes(i,2);
% calculo los coeficientes
[ coeff1 ] = f_coeff1( alphas, alphaj );
[ coeff2 ] = f_coeff2( alphas, alphaj, betaj );
[ coeff3 ] = f_coeff3( alphas, alphaj, betas, betaj );
% calculo el SMR y lo pongo
% redondeo a la parte entera
coeff4 = str2double(get(handles.box_F4,'String'));
SMRRomana = max(0,floor(RMRb + coeff1 * coeff2 * coeff3 + coeff4));
planes(i,4)=SMRRomana;
end
% guardo el resultado en la tabla
set(handles.uitable_planes,'Data',planes);
% calculo ahora las cuñas y sus SMR
slope = get(handles.uitable_slope,'Data');
alphas=slope(1,1);
betas=slope(1,2);
planes = get(handles.uitable_planes,'Data');
[nplanos,~]=size(planes);
% determino el número total de cuñas
tamanyo = 0;
for i=1:(nplanos-1)
tamanyo = tamanyo +i;
end
wedges = zeros(1,8);
contador = 1;
for i=1:(nplanos-1)
alphaj1=planes(i,1);
betaj1=planes(i,2);
rmrb1=planes(i,3);
for j=i+1:nplanos
alphaj2=planes(j,1);
betaj2=planes(j,2);
rmrb2=planes(j,3);
% calculo la cuña
[ w,b, angle, possible ] = f_calculatewedge( alphas, betas, alphaj1, betaj1, alphaj2, betaj2 );
% calculo el SMR de la cuña
[ coeff1 ] = f_coeff1( alphas, w );
[ coeff2 ] = f_coeff2( alphas, w, b );
[ coeff3 ] = f_coeff3( alphas, w, betas, b );
[ tiporotura ] = f_tiporotura( alphas, w );
% F1F2F3Romana = coeff1*coeff2*coeff3;
% calculo el SMR y lo pongo
% redondeo a la parte entera
coeff4 = str2double(get(handles.box_F4,'String'));
RMRb = min(rmrb1, rmrb2);
if strcmp(tiporotura,'Toppling')
SMRRomana = 100;
else
SMRRomana = max(0,floor(RMRb + coeff1 * coeff2 * coeff3 + coeff4));
end
% pongo la salida donde toca
wedges(contador,1)=i;
wedges(contador,2)=j;
wedges(contador,3)=w;
wedges(contador,4)=b;
wedges(contador,5)=min(rmrb1,rmrb2);
wedges(contador,6)=angle;
wedges(contador,7)=possible;
wedges(contador,8)=SMRRomana;
contador = contador +1;
end
end
set(handles.uitable_wedges,'Data',wedges);
catch
end
% --- Executes on slider movement.
function slider_elementid_Callback(hObject, eventdata, handles)
% hObject handle to slider_elementid (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
id=round(get(hObject,'Value'));
set(handles.box_elementid,'String',num2str(id));
% ejecuto el callback de ese box para que guarde los números
box_elementid_Callback(hObject, eventdata, handles)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider_elementid_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider_elementid (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes on button press in radiobutton_plane.
function radiobutton_plane_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton_plane (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
boton = get(hObject,'Value');
if boton == 1
set(handles.radiobutton_wedge,'Value',0);
planes=get(handles.uitable_planes,'Data');
[n,~]=size(planes);
set(handles.slider_elementid,'Min',1,'Max',n,'Value',1,'SliderStep',[1 1]/(n-1));
set(handles.box_elementid,'String','1');
box_elementid_Callback(hObject, eventdata, handles)
end
% Hint: get(hObject,'Value') returns toggle state of radiobutton_plane
% --- Executes on button press in radiobutton_wedge.
function radiobutton_wedge_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton_wedge (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
boton = get(hObject,'Value');
if boton == 1
set(handles.radiobutton_plane,'Value',0);
wedges=get(handles.uitable_wedges,'Data');
[n,~]=size(wedges);
set(handles.slider_elementid,'Min',1,'Max',n,'Value',1,'SliderStep',[1 1]/(n-1));
set(handles.box_elementid,'String','1');
box_elementid_Callback(hObject, eventdata, handles);
end
% Hint: get(hObject,'Value') returns toggle state of radiobutton_wedge
function box_elementid_Callback(hObject, eventdata, handles)
% hObject handle to box_elementid (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
id=str2double(get(handles.box_elementid,'String'));
if get(handles.radiobutton_plane,'Value')==0 && get(handles.radiobutton_wedge,'Value')==0
% no hago nada
else
if get(handles.radiobutton_plane,'Value')==1
% es un plano
planos=get(handles.uitable_planes,'Data');
alphaj=planos(id,1);
betaj=planos(id,2);
rmrb=planos(id,3);
else
if get(handles.radiobutton_wedge,'Value')==1
% es una cuña
wedges=get(handles.uitable_wedges,'Data');
alphaj=wedges(id,3);
betaj=wedges(id,4);