how to fix Index exceeds matrix dimensions ?

3 Ansichten (letzte 30 Tage)
ElizabethR
ElizabethR am 7 Mai 2016
Bearbeitet: ElizabethR am 7 Mai 2016
for i=1:jumlah
filename=strcat('C:\Users\Documents\MATLAB\data\dataujiKW\',num2str(i),'.jpg');
image=imread(filename);
value=cast(extraction(image),'single'); %extraction is a function
counter=counter+1;
result{counter,1}=image;
for i=1:9
result{counter,i+1}=extraction(i);
end
hasilesktraksi=[result{i,2:10}]; // error
end
but, if i run in command window with command : hasilesktraksi=[hasiluji{1,2:10}], it not error and give the result. help please, thanks
  4 Kommentare
Image Analyst
Image Analyst am 7 Mai 2016
I tried, below. Did you even see my answer below???
ElizabethR
ElizabethR am 7 Mai 2016
Bearbeitet: ElizabethR am 7 Mai 2016
yes, i've seen your answare below. thank you ^^

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 7 Mai 2016
Looks like you're confused by cell arrays and concatenation. Instead of this:
hasilesktraksi=[result{i,2:10}]; // error
try this:
hasilesktraksi = extraction(1:9);
It's the same thing but avoiding using confusing cell arrays.
  1 Kommentar
ElizabethR
ElizabethR am 7 Mai 2016
yes, you're right. thanks for explanation and reference. God Bless ^^

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by