Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7945203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:47:23+00:00 2026-06-04T00:47:23+00:00

I’m a total beginner to matlab and I’m currently writing a script for extracting

  • 0

I’m a total beginner to matlab and I’m currently writing a script for extracting data from a thermographic video.

Firstly the video is cut in separate frames. The first frame is opened as a sample picture to define the coordinates of sampling points. The goal is then to select the rgb values of those defined coordinates from a set of frames and save them into a matrix.

Now I have a problem separating the matrix to n smaller matrices.
e.g I’m defining the number of points to be selected to n=2 , with a picture count of 31. Now it returns a matrix stating the rgb codes for 31 pictures, each at 2 points, in a 62×3 double matrix…

Now I want to extract the 1st, 3rd, 5th….etc… row to a new matrix…this should be done in a loop, according to the number of n points…e.g 5 points on each picture equals 5 matrices, containing values of 31 pictures….

this is an extract of my code to analyse the pictures, it returns the matrix ‘values’

files = dir('*.jpg');
num_files = numel(files);

images = cell(1, num_files);
cal=imread(files(1).name);

n = input('number of selection points?: ');

imshow(cal);

[x,y] = ginput(n);

eval(get(1,'CloseRequestFcn'))

%# x = input('x-value?: ');   manual x selection
%# y = input('y-value?: ');   manual y selection

for k = 1:num_files
    images{k} = imread(files(k).name); 
end

matrix=cell2mat(images);
count=(0:size(matrix,1):size(matrix,1)*num_files);

for k = 1:num_files
    a(k)= mat2cell(impixel(matrix,x+count(k),y));
end

values = cat(1,a{:})
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:47:25+00:00Added an answer on June 4, 2026 at 12:47 am

    Easy fix

    Do you mean that if you have:

    n = 2;
    k = 2; % for example
    matrix = [1 2 3;
              4 5 6;
              7 8 9;
              8 7 6];
    

    you want it to become

    b{1} = [1 2 3;
            7 8 9];
    b{2} = [4 5 6;
            8 7 6];
    

    This can be easily done with:

     for ii = 1:n
         b{ii} = matrix(1:n:end,:);
     end
    

    Better fix

    Of course it’s also possible to just reshape your data matrix and use that instead of the smaller matrices: (continuing with my sample data ^^)

    >> d=reshape(matrix',3,2,[]);
    >> squeeze(d(:,1,:))
    
    ans =
    
         1     7
         2     8
         3     9
    >> squeeze(d(:,2,:))
    
    ans =
    
         4     8
         5     7
         6     6
    

    Good practice

    Or, my preferred choice: save the data immediately in an easy to access way. Here I think it will be an matrix of size: [num_files x num_points x 3]

    If you want all the first points:

    rgb_data(:,1,:)
    

    only the red channel of those points:

    rgb_data(:,1,1)
    

    and so on.
    I think this is possible with this:

    rgb_data = zeros(num_files, num_points, 3);
    for kk = 1:num_files
        rgb_data(kk,:,:) = impixel(images{kk},x+count(k),y);
    end
    

    But I don’t understand the complete meaning of your code (eg: why matrix=cell2mat(images) ??? and then of course:

    count=(0:size(matrix,1):size(matrix,1)*num_files);
    

    is just count=0:num_files;
    so I’m not sure what would come out of impixel(matrix,x+count(k),y) and I used images{k} 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to construct a data frame in an Rcpp function, but when I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.