Filter löschen
Filter löschen

Error in lplot (line 3) Figure = plot(shifts,data);

1 Ansicht (letzte 30 Tage)
Ewan Hislop
Ewan Hislop am 31 Mai 2019
Kommentiert: Steven Lord am 31 Mai 2019
Using this script:
cd('/Users/Ewan/Desktop/MATLAB/Extracted data')
load('PC3_D55')
load('PNT2_D55')
quality control (run for each data set)
close all
lplot(shift, PC3_D55); title('PC3');
[shift_cut, PC3_D55] = AJ_QT_cutrange(shift, PC3_D55);
quality control (run for each data set)
close all
lplot(shift, PNT2_D55); title('PNT2');
[shift_cut, PNT2_D55] = AJ_QT_cutrange(shift, PNT2_D55);
scale to 2935 peak
a=scale2935(PC3_D55);
b=scale2935(PNT2_D55);
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', [Red]);
set(h1, 'LineWidth',2);
hold on
h2 = plot(shift_cut, mean(b), 'Color', [Blue]);
set(h2, 'LineWidth',2);
hold off
legend('PC3 3','PNT2 3');
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
DMSO_all=[a];
TOFA_all=[b];
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(DMSO_all), 'Color', [Red]);
set(h1, 'LineWidth',1);
hold on
h2 = plot(shift_cut, mean(TOFA_all), 'Color', [Blue]);
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_DMSO]=extract_ratio_2850_2935_AJ(DMSO_all);
[ratio1_TOFA]=extract_ratio_2850_2935_AJ(TOFA_all);
ratio2 = 2880/2935
[ratio2_DMSO]=extract_ratio_2880_2935_AJ(DMSO_all);
[ratio2_TOFA]=extract_ratio_2880_2935_AJ(TOFA_all);
I keep getting the ERROR:
Error using plot
Vectors must be the same length
Error in lplot (line 3)
Figure = plot(shifts,data);
Funny thing is that it works for some .mat files I run and often I get this error.
I cant work out why...please help?
  5 Kommentare
Ewan Hislop
Ewan Hislop am 31 Mai 2019
Im not sure what is being asked sorry
Steven Lord
Steven Lord am 31 Mai 2019
Set an error breakpoint to pause when MATLAB throws an error.
Run your code.
When MATLAB pauses due to that error, look at the size of the shifts and data variables. They won't be the same length.
You will need to determine, by examining the data in your program, why the variables aren't the same length. At the very least you'll probably be able to tell (assuming you're looping over a list of file names) which file has the data of unexpected length.
Since lplot doesn't appear to be a function in a MathWorks product, you may want to either contact the author of that function or post a link where people on Answers can see what it does (don't post the function itself without the author's permission) and we may be able to see if it does something unusual that would cause this error.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by