조회 수 1424 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
라이선스 MIT

<배경>

역시 이것도 귀차니즘에 의해 만들어졌습니다... 

회사에서 SPR 분석을 하는데, 이 결과를 비교/분석할 때는 꺾은선 그래프(line plot)를 이용합니다. 

근데 엑셀로 변환해도 와 범위가 몇천초...... 이걸 언제 다 씌워서 그래프 그리고 이동하고...... 

 

귀찮아요. 너무 귀찮아요. 그래서 만들었습니다. 

 

<코드 1-샘플(가장 최근꺼)>

function extriplot(~,~,~)
path=input('경로를 입력해주세요. ','s'); 
name=input('파일 이름은?' ,'s'); 
graphname=input('그래프 이름은?' ,'s'); 
pathway=strcat(path,'\');
filename=strcat(name,'.xlsx');
label1=input('첫 번째 plot의 이름은?','s');
label2=input('두 번째 plot의 이름은?','s');
label3=input('세 번째 plot의 이름은?','s');
disp('일단 그래프를 그리려면 행렬을 먼저 만들어야 해. 끝이 어딘지만 입력해주면 알아서 집을게.');
    shx1='2'; %엑셀로 그래프 그림+시작점은 항상 2
    shx2=input('각 축의 끝부분은? ','s'); 
        sheetX=strcat('A',shx1,':','A',shx2);
        sheetY=strcat('B',shx1,':','B',shx2);
        sheetY2=strcat('C',shx1,':','C',shx2);
        sheetY3=strcat('D',shx1,':','D',shx2);
X=xlsread(strcat(pathway,filename),1,sheetX);
Y=xlsread(strcat(pathway,filename),1,sheetY);
Y2=xlsread(strcat(pathway,filename),1,sheetY2);
Y3=xlsread(strcat(pathway,filename),1,sheetY3);
    plot(X,Y,'color',[.47 .67 .19],'LineWidth',2);
    hold on
    plot(X,Y2,'color',[.92 .07 .23],'LineWidth',2);
    plot(X,Y3,'-.','color',[.5 .5 .5]); %reference channel 전용 설정입니다. 가급적이면 엑셀 파일의 D열에 reference channel을 올려주세요. 
xlabel('Time(sec)');
ylabel('Pix');
title(graphname);
legend(label1, label2, label3);

 

이거 아직 다 수정 안 된거예요. 버전도 두 개 있어요... 'ㅁ' 

 

<코드 2-합쳐버린 거>

function SLplot (~)
global pathway pathwayload shx1 %어 글로벌 이렇게 쓰는거였어? 
disp('이거 streptavidin하고 linker 한꺼번에 그려주는거야. 다른 그래프 그릴거면 다른 함수 써야되는거 알지? ');
pathway=input('경로를 부시죠. ','s');
pathwayload=strcat(pathway,'\');
SAfile='SA.xlsx';
Lifile='Linker.xlsx';
disp('좋아, 이제 행렬을 만들어볼건데... 각 행렬의 끝부분이 필요해. 엑셀 가서 쉬프트 컨트롤 아래화살표였나...그거 눌러도 되고, 따로 적어둔 게 있으면 더 좋고. ');
shx1='2';
SAshx2=input('streptavidin 축의 끝부분은? ','s');

        sheetSA1=strcat('A',shx1,':','A',SAshx2);
        sheetSA2=strcat('B',shx1,':','B',SAshx2);
        sheetSA3=strcat('C',shx1,':','C',SAshx2);
        sheetSA4=strcat('D',shx1,':','D',SAshx2);
SA1=xlsread(strcat(pathwayload,SAfile),1,sheetSA1);
SA2=xlsread(strcat(pathwayload,SAfile),1,sheetSA2);
SA3=xlsread(strcat(pathwayload,SAfile),1,sheetSA3);
SA4=xlsread(strcat(pathwayload,SAfile),1,sheetSA4);
Lishx2=input('Linker 축의 끝부분은? ','s');
        sheetLi1=strcat('A',shx1,':','A',Lishx2);
        sheetLi2=strcat('B',shx1,':','B',Lishx2);
        sheetLi3=strcat('C',shx1,':','C',Lishx2);
        sheetLi4=strcat('D',shx1,':','D',Lishx2);
Li1=xlsread(strcat(pathwayload,Lifile),1,sheetLi1);
Li2=xlsread(strcat(pathwayload,Lifile),1,sheetLi2);
Li3=xlsread(strcat(pathwayload,Lifile),1,sheetLi3);
Li4=xlsread(strcat(pathwayload,Lifile),1,sheetLi4);
disp('음. 범위는 됐고... 행렬도 OK. ');
%아나 함수 합치기 그지같네 ㅠㅠ 
disp('자, 이제 행렬을 만들었으니 그걸로 그래프를 그릴거야. streptavidin 먼저 해 줄게. ');
figure(1);
    plot(SA1,SA2,'color',[.27 .5 .7],'LineWidth',2);
    hold on
    plot(SA1,SA3,'color',[.52 .81 .47],'LineWidth',2);
    plot(SA1,SA4,'color',[.4 .2 .6],'LineWidth',2);
    xlabel('Time(sec)');
    ylabel('Pix');
    title('Streptavidin')
    legend('ch1','ch2','ch3','Location','southeast');
disp('streptavidin 완료! 다음은 링커~ ');
figure(2);
    plot(Li1,Li2,'color',[.27 .5 .7],'LineWidth',2);
    hold on
    plot(Li1,Li3,'color',[.52 .81 .47],'LineWidth',2);
    plot(Li1,Li4,'color',[.4 .2 .6],'LineWidth',2);
    xlabel('Time(sec)');
    ylabel('Pix');
    title('Linker')
    legend('ch1','ch2','ch3','Location','southeast');
disp('좋아, 이제 저장 한다.');
SAjpg=strcat(pathwayload,'SA.jpg');
Lijpg=strcat(pathwayload,'Linker.jpg');
saveas(figure(1),SAjpg);
saveas(figure(2),Lijpg);

 

<프로그램의 역사>

1. 귀찮아서 그냥 plot만 그리는 함수를 짰음

2. 축 라벨 붙이기 귀찮아서 라벨 추가

3. 그래프 선 일일이 바꾸기 귀찮아서 선 옵션 추가(그 뒤로 선 색깔은 쭉 고정) -여기서 셋 다 실선인 것과 하나는 점선인 것으로 분리

4. 엑셀파일 경로 뒤의 \랑 파일명 뒤의 확장자 고정(...) 역시나 사유는 귀찮아서. 

5. 그래프 레전드 입력 받아서 그리게끔 변경

6. 엑셀로 입력할 때 시발점은 항상 2이므로 고정 -파일명도 고정된 것들 아예 입력 때려박음(그래프 그릴 때 샘플 말고 그 전에 흘려주는 것들도 그리는데 그거 말하는겁니다) 

7. 샘플 흘리기 전에 그리는 그래프 함수 하나로 묶어버림(두 번 그리기 귀찮아서), 이 과정에서 그래프 범례를 우측 하단으로 위치 바꾸고 저장까지 알아서 되게끔 설정. (경로는 global로 때려박음)

아 참고로 샘플 그래프에도 이 기능 추가해야 하는데 지금 휴가라 안하고 있습니다. (...) 

 

뭔 기능이 죄다 귀찮아서 추가되냐 

 


  1. 폰트를 자동 설치하는 코드

    Date2018.07.16 Category코드 By네모 Views830
    Read More
  2. 파이썬을 이용한 텔레그램 새 글 알림 (허접합니다)

    Date2017.11.19 Category코드 By이니스프리 Views2377
    Read More
  3. 파이선 셸에서 실행하면...?

    Date2018.07.22 Category코드 By제르엘 Views499
    Read More
  4. 클라이언트단에서 이미지 리사이징

    Date2018.05.06 Category코드 By네모 Views1078
    Read More
  5. 컴퓨터의 uuid 얻기

    Date2018.01.28 Category코드 Bytitle: 황금 서버 (30일)humit Views1099
    Read More
  6. 잘못 쓰면 컴퓨터가 날아가는 코드

    Date2018.07.08 Category코드 By제르엘 Views964
    Read More
  7. 이게 팔릴까 - Xe/라이믹스 에러페이지 [2017-10-04]

    Date2017.10.04 Category자료 Bytitle: 열려라 맛스타의 자물쇠TVJ Views672
    Read More
  8. 유튜브에 약간의 기능을 추가 해주는 크롬 확장 프로그램.

    Date2018.01.26 Category코드 ByHanam09 Views942
    Read More
  9. 엑셀파일 불러서 히스토그램 그려주는 함수

    Date2017.08.03 Category코드 By국내산라이츄 Views724
    Read More
  10. 엑셀 읽어서 그래프 그려주는 함수

    Date2017.08.03 Category코드 By국내산라이츄 Views1424
    Read More
  11. 아주 간단한 기초 C++

    Date2018.04.21 Category코드 By제르엘 Views477
    Read More
  12. 소셜XE / 기존 통합 로그인 스킨 V2.2

    Date2017.06.28 Category자료 ByNoYeah Views908
    Read More
  13. 세린서버에서 시도중인 백업 스크립트 입니다.

    Date2017.06.27 Category코드 ByNoYeah Views745
    Read More
  14. 새 글 자동 댓글 스크립트 (AutoHotkey)

    Date2017.11.26 Category코드 By이니스프리 Views3458
    Read More
  15. 사이트 서버 이전 (또는 미러링 사이트 구축) 쉽게하는 스크립트

    Date2018.01.14 Category코드 ByNoYeah Views858
    Read More
  16. 브라우저 언어에 따라 다른 폴더를 사용하는 PHP 코드

    Date2017.10.10 Category코드 By네모 Views639
    Read More
  17. 미완성 받아쓰기 (C)

    Date2018.04.20 Category코드 Bytitle: 대한민국 국기gimmepoint Views380
    Read More
  18. 매우 특이한 버그

    Date2018.06.05 Category코드 Bytitle: 대한민국 국기gimmepoint Views569
    Read More
  19. 링크 파싱 애드온용 스킨 (트위터 스타일)

    Date2017.10.03 Category자료 BySNAX Views516
    Read More
  20. 도박 중독자를 위한 광고 차단 규칙

    Date2020.08.21 Category코드 By제르엘 Views292
    Read More
Board Pagination Prev 1 2 3 4 Next
/ 4