Cant run this script, trying to plot a graph, please help

2 ビュー (過去 30 日間)
Ewan Hislop
Ewan Hislop 2019 年 5 月 20 日
コメント済み: Stephen23 2019 年 5 月 25 日
Can anyone tell me why the script below wont run??
I get this error when I attempt to run:
>> plot_data_AJ
Undefined function or variable 'PC3_DMSO_0p5uM_4c'.
Error in plot_data_AJ (line 12)
lplot(shift, PC3_DMSO_0p5uM_4c);title('PC3_DMSO_0p5uM_4c');
The script:
%% open folder with extracted data and import all extracted data (add a load line for each data set)
clear
cd('/Users/Ewan/Desktop/MATLAB/Extracted files')
load('PC3_DMSO_0p5uM_4c')
load('PC3_DMSO_0p5uM_5c')
load('PC3_DMSO_0p5uM_6c')
load('PNT2_DMSO_0p5uM_1')
load('PNT2_DMSO_0p5uM_3')
load('PNT2_DMSO_0p5uM_5')
%% quality control (run for each data set)
close all
lplot(shift, PC3_DMSO_0p5uM_4c);title('PC3_DMSO_0p5uM_4c');
[shift_cut PC3_DMSO_0p5uM_4c] = AJ_QT_cutrange(shift, PC3_DMSO_0p5uM_4c);
%% quality control (run for each data set)
close all
lplot(shift, PC3_DMSO_5uM_7);title('PC3_DMSO_0p5uM_5c');
[shift_cut PC3_DMSO_0p5uM_5c] = AJ_QT_cutrange(shift, PC3_DMSO_0p5uM_5c);
%% quality control (run for each data set)
close all
lplot(shift, PC3_DMSO_0p5uM_6c);title('PC3_DMSO_0p5uM_6c')
[shift_cut PC3_DMSO_0p5uM_6c] = AJ_QT_cutrange(shift, PC3_DMSO_0p5uM_6c);
%% quality control (run for each data set)
close all
lplot(shift, PNT2_DMSO_0p5uM_1);title('PNT2_DMSO_0p5uM_1')
[shift_cut PNT2_DMSO_0p5uM_1] = AJ_QT_cutrange(shift, PNT2_DMSO_0p5uM_1);
%% quality control (run for each data set)
close all
lplot(shift, PNT2_DMSO_0p5uM_3);title('PNT2_DMSO_0p5uM_3')
[shift_cut PNT2_DMSO_0p5uM_3] = AJ_QT_cutrange(shift, PNT2_DMSO_0p5uM_3);
%% quality control (run for each data set)
close all
lplot(shift, PNT2_DMSO_0p5uM_5);title('PNT2_DMSO_0p5uM_5')
[shift_cut PNT2_DMSO_0p5uM_5] = AJ_QT_cutrange(shift, PNT2_DMSO_0p5uM_5);
%% scale to 2935 peak
a=scale2935(PC3_DMSO_0p5uM_4c);
b=scale2935(PC3_DMSO_0p5uM_5c);
c=scale2935(PC3_DMSO_0p5uM_6c);
d=scale2935(PNT2_DMSO_0p5uM_1);
e=scale2935(PNT2_DMSO_0p5uM_3);
f=scale2935(PNT2_DMSO_0p5uM_5);
%% plot to compare data sets mean for each individual data set
Black = caz_rgb_chart('Black');
Magenta = caz_rgb_chart('Magenta');
Lime = caz_rgb_chart('Lime');
Red = caz_rgb_chart('Red');
Blue = caz_rgb_chart('Blue');
Purple = caz_rgb_chart('Purple');
figure;
h1= plot(shift_cut, mean(a), 'Color', [Black]);
set(h1, 'LineWidth',2);
hold on
h2 = plot(shift_cut, mean(b), 'Color', [Black]);
set(h2, 'LineWidth',2);
h3 = plot(shift_cut, mean(c), 'Color', [Magenta]);
set(h3, 'LineWidth',2);
hold off
legend('PC3','PNT2');
set(legend,'Color','none');
axis('tight')
set(gca,'box','off')
set(gcf,'Color',[1 1 1])
xlabel('Raman Shift/cm^-^1','FontWeight','bold','FontSize',16,'FontName','Arial')
ylabel('Counts', 'FontWeight','bold','FontSize',16,'FontName','Arial')
set(gca,'FontWeight','bold','FontSize',16,'FontName','Arial');
%% group all data sets from same conditions together
PC3_all=[a;b;c];
PNT2_all=[d;e;f];
%% plot to compare data sets mean by condition
Black = caz_rgb_chart('Black');
Magenta = caz_rgb_chart('Magenta');
Lime = caz_rgb_chart('Lime');
Red = caz_rgb_chart('Red');
Blue = caz_rgb_chart('Blue');
Purple = caz_rgb_chart('Purple');
figure;
h1= plot(shift_cut, mean(PC3_all), 'Color', [Black]);
set(h1, 'LineWidth',1);
hold on
h2 = plot(shift_cut, mean(PNT2_all), 'Color', [Magenta]);
set(h2, 'LineWidth',1);
hold off
legend('PC3','PNT2');
set(legend,'Color','none');
axis('tight')
set(gca,'box','off')
set(gcf,'Color',[1 1 1])
xlabel('Raman Shift/cm^-^1','FontWeight','bold','FontSize',16,'FontName','Arial')
ylabel('A.U.', 'FontWeight','bold','FontSize',16,'FontName','Arial')
set(gca,'FontWeight','bold','FontSize',16,'FontName','Arial');
%% ratio1 = 2850/2935
[ratio1_PC3]=extract_ratio_2850_2935_AJ(PC3_all);
[ratio1_PNT2]=extract_ratio_2850_2935_AJ(PNT2_all);
%% ratio2 = 2880/2935
[ratio2_PC3]=extract_ratio_2880_2935_AJ(PC3_all);
[ratio2_PNT2]=extract_ratio_2880_2935_AJ(PNT2_all);
Many thanks in advance
  4 件のコメント
Star Strider
Star Strider 2019 年 5 月 20 日
@Ewan — Rik’s suggestion is to do something like this:
D1 = load('PC3_DMSO_0p5uM_4c')
then post the result that appears in your Command Window. It will appear as structure ‘D1’ with at least one field. It may be that whatever is in that file is not named ‘PC3_DMSO_0p5uM_4c’. The same may be true for the other files.
Alternatively, you could attach all your .mat files to a comment here so we could look at them.
Stephen23
Stephen23 2019 年 5 月 25 日
Ewan Hislop's "Answer" moved here:
Hi Star Strider,
I attempted the D1=, it created structures for each and I removed the clear but it failed at line 12 again.
Please find attached the .mat files. I hope you can make more sense out of this as I'm out of ideas.
Thanks again :)

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2019 年 5 月 20 日
My pleasure.
When I did:
D1 = load('PC3_DMSO_0.5uM_4c.mat')
I got:
D1 =
struct with fields:
PC3_TOFA_5uM_8: [296×633 double]
output: [425376×1 double]
ratio1: [21×32 double]
ratio2: [21×32 double]
shift: [633×1 double]
I am not certain which one of those you want. It is important t note that none of them is named ‘PC3_DMSO_0p5uM_4c’.
Also, the file names in your code do not match the file names you attached. The actual file names have decimal points, while the file names in your code have the letter ‘p’ in that position.
I did not download the other files. The one I downloaded and opened illustrates the problem.
We cannot run your code, because we do not have the ‘lplot’ function. However, you may not need it, because this:
D1 = load('PC3_DMSO_0.5uM_4c.mat')
PC3_TOFA_5uM_8 = D1.PC3_TOFA_5uM_8;
shift = D1.shift;
figure
plot(shift, PC3_TOFA_5uM_8)
grid
may do what you want. (I have no idea what I’m looking at, in that plot, so I cannot comment further.)
  4 件のコメント
Star Strider
Star Strider 2019 年 5 月 21 日
You’re not a nuisance. I just have no idea what you are doing, or what the data in your files are.
You should have all the MATLAB functions I use in my Answer and Comments.
To process your files, see for example: Import or Export a Sequence of Files (link).
Image Analyst
Image Analyst 2019 年 5 月 25 日
Well sometimes he is, like when he deletes his questions, as he's done before. Below is the original question here:
Can anyone tell me why the script below wont run??
I get this error when I attempt to run:
>> plot_data_AJ
Undefined function or variable 'PC3_DMSO_0p5uM_4c'.
Error in plot_data_AJ (line 12)
lplot(shift, PC3_DMSO_0p5uM_4c);title('PC3_DMSO_0p5uM_4c');
The script:
%% open folder with extracted data and import all extracted data (add a load line for each data set)
clear
cd('/Users/Ewan/Desktop/MATLAB/Extracted files')
load('PC3_DMSO_0p5uM_4c')
load('PC3_DMSO_0p5uM_5c')
load('PC3_DMSO_0p5uM_6c')
load('PNT2_DMSO_0p5uM_1')
load('PNT2_DMSO_0p5uM_3')
load('PNT2_DMSO_0p5uM_5')
%% quality control (run for each data set)
close all
lplot(shift, PC3_DMSO_0p5uM_4c);title('PC3_DMSO_0p5uM_4c');
[shift_cut PC3_DMSO_0p5uM_4c] = AJ_QT_cutrange(shift, PC3_DMSO_0p5uM_4c);
%% quality control (run for each data set)
close all
lplot(shift, PC3_DMSO_5uM_7);title('PC3_DMSO_0p5uM_5c');
[shift_cut PC3_DMSO_0p5uM_5c] = AJ_QT_cutrange(shift, PC3_DMSO_0p5uM_5c);
%% quality control (run for each data set)
close all
lplot(shift, PC3_DMSO_0p5uM_6c);title('PC3_DMSO_0p5uM_6c')
[shift_cut PC3_DMSO_0p5uM_6c] = AJ_QT_cutrange(shift, PC3_DMSO_0p5uM_6c);
%% quality control (run for each data set)
close all
lplot(shift, PNT2_DMSO_0p5uM_1);title('PNT2_DMSO_0p5uM_1')
[shift_cut PNT2_DMSO_0p5uM_1] = AJ_QT_cutrange(shift, PNT2_DMSO_0p5uM_1);
%% quality control (run for each data set)
close all
lplot(shift, PNT2_DMSO_0p5uM_3);title('PNT2_DMSO_0p5uM_3')
[shift_cut PNT2_DMSO_0p5uM_3] = AJ_QT_cutrange(shift, PNT2_DMSO_0p5uM_3);
%% quality control (run for each data set)
close all
lplot(shift, PNT2_DMSO_0p5uM_5);title('PNT2_DMSO_0p5uM_5')
[shift_cut PNT2_DMSO_0p5uM_5] = AJ_QT_cutrange(shift, PNT2_DMSO_0p5uM_5);
%% scale to 2935 peak
a=scale2935(PC3_DMSO_0p5uM_4c);
b=scale2935(PC3_DMSO_0p5uM_5c);
c=scale2935(PC3_DMSO_0p5uM_6c);
d=scale2935(PNT2_DMSO_0p5uM_1);
e=scale2935(PNT2_DMSO_0p5uM_3);
f=scale2935(PNT2_DMSO_0p5uM_5);
%% plot to compare data sets mean for each individual data set
Black = caz_rgb_chart('Black');
Magenta = caz_rgb_chart('Magenta');
Lime = caz_rgb_chart('Lime');
Red = caz_rgb_chart('Red');
Blue = caz_rgb_chart('Blue');
Purple = caz_rgb_chart('Purple');
figure;
h1= plot(shift_cut, mean(a), 'Color', [Black]);
set(h1, 'LineWidth',2);
hold on
h2 = plot(shift_cut, mean(b), 'Color', [Black]);
set(h2, 'LineWidth',2);
h3 = plot(shift_cut, mean(c), 'Color', [Magenta]);
set(h3, 'LineWidth',2);
hold off
legend('PC3','PNT2');
set(legend,'Color','none');
axis('tight')
set(gca,'box','off')
set(gcf,'Color',[1 1 1])
xlabel('Raman Shift/cm^-^1','FontWeight','bold','FontSize',16,'FontName','Arial')
ylabel('Counts', 'FontWeight','bold','FontSize',16,'FontName','Arial')
set(gca,'FontWeight','bold','FontSize',16,'FontName','Arial');
%% group all data sets from same conditions together
PC3_all=[a;b;c];
PNT2_all=[d;e;f];
%% plot to compare data sets mean by condition
Black = caz_rgb_chart('Black');
Magenta = caz_rgb_chart('Magenta');
Lime = caz_rgb_chart('Lime');
Red = caz_rgb_chart('Red');
Blue = caz_rgb_chart('Blue');
Purple = caz_rgb_chart('Purple');
figure;
h1= plot(shift_cut, mean(PC3_all), 'Color', [Black]);
set(h1, 'LineWidth',1);
hold on
h2 = plot(shift_cut, mean(PNT2_all), 'Color', [Magenta]);
set(h2, 'LineWidth',1);
hold off
legend('PC3','PNT2');
set(legend,'Color','none');
axis('tight')
set(gca,'box','off')
set(gcf,'Color',[1 1 1])
xlabel('Raman Shift/cm^-^1','FontWeight','bold','FontSize',16,'FontName','Arial')
ylabel('A.U.', 'FontWeight','bold','FontSize',16,'FontName','Arial')
set(gca,'FontWeight','bold','FontSize',16,'FontName','Arial');
%% ratio1 = 2850/2935
[ratio1_PC3]=extract_ratio_2850_2935_AJ(PC3_all);
[ratio1_PNT2]=extract_ratio_2850_2935_AJ(PNT2_all);
%% ratio2 = 2880/2935
[ratio2_PC3]=extract_ratio_2880_2935_AJ(PC3_all);
[ratio2_PNT2]=extract_ratio_2880_2935_AJ(PNT2_all);
Many thanks in advance

サインインしてコメントする。

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by