I'm getting an error which I don't understand: index exceeds matrix dimensions, what does it mean?

조회 수: 3 (최근 30일)
When i'm using this code: for i=1:size(m,1) VaR(i,1)=-quantile(AEurostoxAR(i+m,1),0.05); end
i'm getting this error: ??? Index exceeds matrix dimensions.
Does somebody know what the error means or what I am doing wrong in my code? I want to calculate the VaR with the historical simulation method. The AEurostoxAR are returns from the EuroStoxx 50 with 782 returns and i'm using a rolling window of 250, so my m=250
Thanks in advance,
kind regards Michiel
  댓글 수: 11
Stephen23
Stephen23 2020년 5월 11일
편집: Stephen23 2020년 5월 11일
"when i run the same code for red channel it works but when i try to split green or blue it dosen't work?"
Nope, it does not "work" on the red channel (it actually "works" on a grayscale image).
"The below code is to split red channel"
No, it does not. Your code uses this line immediately after importing the image data:
a = rgb2gray(a);
to convert a (presumably) RGB image to an MxN grayscale matrix. After that line:
  • a does not have a red channel.
  • a does not have a green channel.
  • a does not have a blue channel.
In the rest of your code a is a grayscale MxN matrix. An MxN matrix a does not have red, green or blue channels. It has no color infomation whatsoever, and certainly has no different color channels.
If you expect different color channels, why are you converting to grayscale?
Huda Zulfiqar
Huda Zulfiqar 2020년 5월 11일
ohhh ok thanks a lot sir i was on mistake ...now i completely understand it

댓글을 달려면 로그인하십시오.

답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by