Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Error saving multiple images

Subject: Error saving multiple images

From: Susan

Date: 14 May, 2012 16:06:18

Message: 1 of 1

Hi all,

I'm having difficulties saving mutliple images with the following code. I'm processing 500 images in total - 10 (i_B in code) groups of 50 (num_A in code) - producing an image for each iteration of i_B (yielding 10 images in total of pixel size (N,50)). The code works fine if I set i_B = 1, 2, 3, etc. manually but I would like to automate it as I will have a larger number of images in the future. The error I am getting is
??? Subscripted assignment dimension mismatch
at the portion of the code below indicated by ******.

I would greatly appreciate any advice!

Kind regards,

P.s. I've omitted some of the preceding code for clarity (will not affect operation)


for i_B = 1:10

    for i = 1:50 file = sprintf('%s%s%d%s',folder,filename,((100*(i_B-1))+1+(2*(i-1))),suffix);
        A = imread(file);
        mA = mean(A);
        mA(1) = mA(2);

        fit = polyfit(nm,mDC,4);
        pDC = polyval(fit,nm);
        S = mA./pDC;
        S = S - mean(S);
        Ses = interp1(nu,S,kes);
        abs_s_tau = abs(fft(Ses));
        img(:,i) = abs_s_tau'; ******

    img = img(1:(pixel/2),:);
    img = log10(img);
    img = mat2gray(img);
    img = img(1:pixel/2,:);

    figure(i_B); clf

    file_saved = strcat(folder,'B-scan_',num2str(i_Bscan),'.png');
    imwrite(img, file_saved ,'png', 'BitDepth', 16);


Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us