{"id":20,"date":"2024-05-02T14:12:18","date_gmt":"2024-05-02T06:12:18","guid":{"rendered":"http:\/\/www.rfnirs.com\/?p=20"},"modified":"2024-05-03T16:59:04","modified_gmt":"2024-05-03T08:59:04","slug":"fnirs%e5%b8%b8%e7%94%a8%e4%bb%a3%e7%a0%81matlab2020a","status":"publish","type":"post","link":"http:\/\/www.rfnirs.com\/index.php\/2024\/05\/02\/fnirs%e5%b8%b8%e7%94%a8%e4%bb%a3%e7%a0%81matlab2020a\/","title":{"rendered":"fNIRS\u5e38\u7528\u4ee3\u7801(Matlab2020a)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u3010\u539f\u521b\u3011<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-primary-color has-text-color has-link-color wp-elements-c24ee4ac0521b1a150bc333319ae3b0c wp-block-paragraph\" style=\"font-size:0.9rem\"><\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:15px\"><code>%% \u5c06\u6587\u4ef6\u5206\u88c5\u5230\u4e0d\u540c\u6587\u4ef6\u5939\nfilePath = uigetdir(); % \u9009\u62e9\u8981\u5904\u7406\u7684\u5b50\u6587\u4ef6\u5939\u6240\u5728\u7684\u6587\u4ef6\u5939 \u6216\u8005\u76f4\u63a5\u6307\u5b9a\ncd(filePath)\nfiles = dir(filePath);\n% oldName = cell(length(files)-2,1);%\u542b\u6709\u6240\u6709\u5b50\u6587\u4ef6\u5939\u540d\u5b57\u7684\u5143\u80de\u6570\u7ec4\u524d\u4e24\u4e2a\u65e0\u6548\nfor i = 1:length(files)-2\nname={files(i+2,1).name(1:end-4)}\nmkdir(name{1,1})\nend\n% file_name=dir(pwd)\nfor j = 1:length(files)-2\n%load(files(3,1).name,'-mat')\nmovefile (files(j+2,1).name, files(j+2,1).name(1:end-4))\nend<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:15px\"><code>%% \u8f6c\u6362\u6570\u636e\u4e3aHERMES\u80fd\u8bc6\u522b\u683c\u5f0f\n%\u672c\u811a\u672c\u8f93\u5165\u6570\u636e\u4e3a\u7ecf\u8fc7Homer2\u9884\u5904\u7406\u7684\u8840\u6c27\u6570\u636e\uff1b\n%Edit by Guangyue Zhu\n%homer\u6570\u636e\nclose\nclear\nclc\nmsgbox('\u8bf7\u9009\u62e9nirs\u6240\u5728\u6587\u4ef6\u5939')\n pause(2)\nfile_name=uigetdir();\ndata_name=dir(&#91;file_name,'\\','*.nirs']);\nmkdir HMS\ndata_length=&#91;1:3600];%\u7edf\u4e00\u6570\u636e\u957f\u5ea6,\u9700\u8981\u4fee\u6539\nfor i =1:length(data_name);\n    load(data_name(i,1).name,'-mat');\n    %if ~isempty(strfind(data_name(i,1).name,'L'))%%\u67e5\u627e\u6587\u4ef6\u540d\u91cc\u6709\u6ca1\u6709L\n   % hermes_data=nirs_data.oxyData;\n   %hermes_data_original=squeeze(procResult.dc(data_length,1,:));\n   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\u8111\u5352\u4e2d\u7ffb\u8f6c\u8fd0\u52a8\u533a,\u7edf\u4e00\u5de6\u4fa7\u4e3a\u6897\u6b7b\u533a\n   %hermes_data(&#91;2 14 15 1 13 16 26 20 21    12 29 30 11 28 27 25 32 31     34 33 18 19 23 24 4 17 6 8 22 10 3 5 7 9])=hermes_data_original(&#91;12 29 30 11 28 27 25 32 31     2 14 15 1 13 16 26 20 21    34 33 18 19 23 24 4 17 6 8 22 10 3 5 7 9])\n    %clear nirs_data\n    %disp(&#91;'complete','-----',data_name(i,1).name]);\n     %save(&#91;file_name,'\\','HMS','\\',data_name(i,1).name(1:end-5),'Ltrans_hms.mat'],'hermes_data');\n   % else\n         hermes_data=squeeze(procResult.dc(data_length,1,:));\n    disp(&#91;'complete','-----',data_name(i,1).name])\n     save(&#91;file_name,'\\','HMS','\\',data_name(i,1).name(1:end-5),'_hms.mat'],'hermes_data');\n    %end\nend<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\" style=\"font-size:15px\"><code>%\u672c\u811a\u672c\u7684\u529f\u80fd\u662f\u5c06.nirs\u8f6c\u6362\u4e3aNIRS_SPM\u80fd\u591f\u8bfb\u53d6\u7684.mat\u683c\u5f0f\uff1b\n%\u8fd0\u884c\u524d\u5c06Homer2\u52a0\u8f7d\u5230\u8def\u5f84\u4e2d\uff1b\n%edited by Guangyue Zhu 2021\/04\/18\nclear\nclc\n msgbox('\u8bf7\u9009\u62e9nirs\u6240\u5728\u6587\u4ef6\u5939')\n pause(2)\nfile_name=uigetdir();\ndata_name=dir(&#91;file_name,'\\','*.nirs']);\n  %mkdir conv\n  %mkdir connect_pro\nfor i = 1:length(data_name);\n    load(data_name(i,1).name,'-mat');\n    if length(SD.Lambda(:,:)) == 2\n         dod = hmrIntensity2OD(d);\n         dc = hmrOD2Conc(dod,SD,&#91;6  6]);\n         nirs_data.oxyData = squeeze(dc(:,1,:));\n         nirs_data.dxyData = squeeze(dc(:,2,:));\n         nirs_data.tHbData = squeeze(dc(:,3,:));\n         delta_t = t(3,1)-t(2,1);\n         nirs_data.fs =floor(1\/delta_t);\n         nirs_data.nch = size(dc,3);\n         nirs_data.marks(:,1)=find(s(:,1));\n         if length(s(1,:)) >=2\n         nirs_data.marks(:,2)=find(s(:,2));\n         end\n         %\u8f6c\u529f\u80fd\u8fde\u63a5\u683c\u5f0f\n%          deoxy=nirs_data.dxyData;\n%          oxy=nirs_data.oxyData;\n%          total=nirs_data.tHbData;\n       % save(&#91;file_name,'\\',data_name(i,1).name(1:end-5),'_FC.mat'],'deoxy','oxy','total');\n         save(&#91;file_name,'\\',data_name(i,1).name(1:end-5),'.mat'],'nirs_data');\n     else\n        dod = hmrIntensity2OD(d);\n         dc = hmrOD2Conc(dod,SD,&#91;6 6 6]);\n        nirs_data.oxyData = squeeze(dc(:,1,:));\n         nirs_data.dxyData = squeeze(dc(:,2,:));\n         nirs_data.tHbData = squeeze(dc(:,3,:));\n         delta_t = t(1,3)-t(1,2);\n         nirs_data.fs = floor(1\/delta_t);\n         nirs_data.nch = size(dc,3);\n         nirs_data.marks(:,1)=find(s(:,1));%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\u5fc5\u8981\u65f6\u4fee\u6539mark\u53f7\u7801\n         if length(s(1,:)) >=2\n         nirs_data.marks(:,2)=find(s(:,2));\n         end\n%          deoxy=nirs_data.dxyData;\n%          oxy=nirs_data.oxyData;\n%         total=nirs_data.tHbData;\n%          save(&#91;file_name,'\\','\\',data_name(i,1).name(1:end-5),'_FC.mat'],'deoxy','oxy','total') ;\n        save(&#91;file_name,'\\','\\',data_name(i,1).name(1:end-5),'.mat'],'nirs_data');\n     end\n     clear nirs_data\n     disp(&#91;'complete','-----',data_name(i,1).name])\nend<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u539f\u521b\u3011<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[6],"tags":[],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry","category-fnirs","entry"],"_links":{"self":[{"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":3,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":23,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/posts\/20\/revisions\/23"}],"wp:attachment":[{"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}