{"id":15,"date":"2024-05-02T13:54:30","date_gmt":"2024-05-02T05:54:30","guid":{"rendered":"http:\/\/www.rfnirs.com\/?p=15"},"modified":"2024-08-16T11:43:43","modified_gmt":"2024-08-16T03:43:43","slug":"fnirs%e5%b8%b8%e7%94%a8%e5%87%bd%e6%95%b0%e6%b1%87%e6%80%bb%ef%bc%88matlab2020a%ef%bc%89","status":"publish","type":"post","link":"http:\/\/www.rfnirs.com\/index.php\/2024\/05\/02\/fnirs%e5%b8%b8%e7%94%a8%e5%87%bd%e6%95%b0%e6%b1%87%e6%80%bb%ef%bc%88matlab2020a%ef%bc%89\/","title":{"rendered":"fNIRS\u5e38\u7528\u51fd\u6570\u6c47\u603b\uff08Matlab2020a\uff09"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"15\" class=\"elementor elementor-15\">\n\t\t\t\t<div class=\"elementor-element elementor-element-68fb716d e-flex e-con-boxed e-con e-parent\" data-id=\"68fb716d\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-403ea480 elementor-widget elementor-widget-text-editor\" data-id=\"403ea480\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.21.0 - 30-04-2024 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t<!-- wp:paragraph -->\n<p>\u3010\u539f\u521b\u3011<\/p>\n<!-- \/wp:paragraph --><!-- wp:paragraph -->\n<p>\u00a0<\/p>\n<!-- \/wp:paragraph --><!-- wp:code {\"style\":{\"border\":{\"width\":\"0px\",\"style\":\"none\"},\"spacing\":{\"margin\":{\"top\":\"0\",\"bottom\":\"0\"}}},\"fontSize\":\"small\"} -->\n<pre class=\"wp-block-code has-small-font-size\" style=\"border-style: none; border-width: 0px; margin-top: 0; margin-bottom: 0;\"><code>\n%% \u5f39\u51fa\u63d0\u793a\u6846\uff0c\u6587\u672c\u5185\u5bb9\u4e3a\u63d0\u793a\u6846\u5185\u5bb9\nmsgbox('\u8bf7\u9009\u62e9\u6587\u4ef6\u5939');\n\n%% \u9009\u62e9\u6587\u4ef6\u5939\uff0c\u5e76\u8bfb\u53d6\u6587\u4ef6\u5939\u4e0b.txt\u7ed3\u5c3e\u6587\u4ef6\uff0c\u8f93\u51fafileName\uff08txt\u6587\u4ef6\u540d\uff09, filePath\uff08\u6587\u4ef6\u6240\u5728\u8def\u5f84\uff09\n[fileName, filePath] = uigetfile('<em>.txt', '\u9009\u62e9\u4e00\u4e2atxt\u6587\u4ef6'); <\/em>\n\n<em>%% \u5bfc\u5165txt\u6570\u636e <\/em>\n<em>raw_parameter=importdata([filePath,fileName]); <\/em>\n\n<em>%% \u5bfb\u627eNaN\\Inf\u503c\u4f4d\u7f6e <\/em>\n<em>pos_nan=find(isnan(raw_parameter.data)); pos_inf=find(isinf(raw_parameter.data)); <\/em>\n\n<em>%% \u627emark\u4f4d\u7f6e find(s) %% \u66ff\u6362NaN\u503c\u6216Inf\u503c\u4e3a\u7279\u5b9a\u6570\u503c(\u672c\u5904\u4e3a-1) raw_parameter.data(pos_nan)=-1; <\/em>\n\n<em>%% \u8f93\u51fa\u6570\u636eA\u7684\u957f\u5ea6 <\/em>\n<em>length(A) <\/em>\n\n<em>%% \u6587\u4ef6\u7ef4\u5ea6\u5927\u5c0f <\/em>\n<em>size(A); <\/em>\n\n<em>%% \u5224\u65ad\u6761\u4ef6 <\/em>\n<em>if a ~=-1\uff1b%\u5982\u679ca\u4e0d\u7b49\u4e8e-1 <\/em>\n<em>b=a;%\u5219b=a <\/em>\n<em>end <\/em>\n\n<em>%% \u8f6c\u7f6e <\/em>\n<em>b=a'; <\/em>\n\n<em>%% \u5c06\u76ee\u6807\u6587\u4ef6\u5939\u8bbe\u7f6e\u4e3a\u5f53\u524d\u6587\u4ef6\u5939 <\/em>\n<em>cd ('E:\\NIRS_toolbox\\test\\data'); <\/em>\n\n<em>%% \u8bfb\u53d6\u5f53\u524d\u6587\u4ef6\u5939\u6700\u540e\u4e00\u5c42\u540d\u79f0 <\/em>\n<em>[~, name, ~] = fileparts(pwd); <\/em>\n\n<em>%% \u8bfb\u53d6file_name\u6587\u4ef6\u5939\u4e0b\u6240\u6709.nirs\u7ed3\u5c3e\u6587\u4ef6\u540d\uff0c\u5e76\u6682\u5b58\u5728data_name\u4e2d data_name=dir([file_name,'\\','<\/em>.nirs']);\n\n%% \u4ee5mat\u683c\u5f0f\u8bfb\u53d6nirs\u6587\u4ef6\nload('test.nirs','-mat');<br \/><br \/>%% \u4ee5mat\u683c\u5f0f\u8bfb\u53d6txt\u6587\u4ef6\nload('test.txt','-ASCII');\n\n%% \u5c06\u5de5\u4f5c\u533a\u7684HbO\u4fdd\u5b58\u5230E:\\NIRS_toolbox\\test\\data\u8def\u5f84\u4e0b\u5e76\u547d\u540d\u4e3asubj1.nirs\nsave('E:\\NIRS_toolbox\\test\\data\\subj1.nirs','HbO');\n\n%% \u4fdd\u5b58\u5f53\u524d\u56fe\u7247\u540d\u79f0\u4e3a\u6fc0\u6d3b\u56fe\uff0c\u683c\u5f0f\u4e3apng\nsaveas(gcf,'\u6fc0\u6d3b\u56fe','png');\n\n%% \u5c06\u77e9\u9635\u5199\u5165exel\u8868\u683c\u5e76\u4fdd\u5b58\nwritematrix(data,[file_name,'\\',name,'max.xls']);\n\n%% \u538b\u7f29\u7ef4\u5ea6\uff0c\u5c06\u5176\u4e2d\u4e00\u4e2a\u5355\u4e00\u6570\u636e\u7684\u7ef4\u5ea6\u53bb\u9664\nsqueeze(HbO(:,1,:));\n\n%% \u6c42\u6700\u5927\u503c\u3001\u6700\u5c0f\u503c\u3001\u5747\u503c\u3001\u6807\u51c6\u5dee;m\u4e3a\u503c\u7684\u5927\u5c0f\uff0cindex\u4e3a\u503c\u7684\u4f4d\u7f6e\n[m,index]=max(A);\n[m,index]=min(A);\n[m,index]=mean(A);\nm=std(data);\n\n%% \u753b\u6563\u70b9\u56fe;\u6a2a\u5750\u6807\u4e3ax,\u7eb5\u5750\u6807\u4e3ay\nscatter(x,y,'r','filled');\n\n%% \u586b\u5145\u8bef\u5dee\u5e26\nfill([x, fliplr(x)], [upperBound, fliplr(lowerBound)], errorColor, 'FaceAlpha', 0.3, 'EdgeColor', 'none'); % \u4f7f\u7528 'FaceAlpha' \u53c2\u6570\u63a7\u5236\u6761\u5e26\u7684\u900f\u660e\u5ea6\n\n%% \u53d6\u6574\nB=floor(A);\n\n%% \u5728\u547d\u4ee4\u7a97\u53e3\u663e\u793a\ndisp('complete')\n\n%% \u5efa\u7acb\u4e00\u4e2a\u6587\u4ef6\u5939\nmkdir([grop_file,'\\',file_name(i,1).name]);\n\n%% \u5355\u6837\u672ct\u68c0\u9a8c\n[h,pvals,ci,stats] = ttest(beta,0);<\/code><\/pre>\n<!-- \/wp:code -->\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u3010\u539f\u521b\u3011 \u00a0<\/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-15","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\/15","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=15"}],"version-history":[{"count":5,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"predecessor-version":[{"id":522,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/posts\/15\/revisions\/522"}],"wp:attachment":[{"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.rfnirs.com\/index.php\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}