Extract a row of multiple files in loop
1 view (last 30 days)
Show older comments
Hi, I would like to get a fixed row from my matrices and save it to one .mat file. for example, in this code, i have 10 different matrices, and would like to save a fixed row (at row 460)from column 1-688. and from the below code, when i put
'line(i) =line+Signal(pixel_line,:);',
it keeps saying
'In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in signal_fluctuation (line 36) line(i) =line+Signal(pixel_line,:);'
please help me. i have no idea how can i do this. BElow is the full code.
clear all close all
addpath 'C:\Program Files\MATLAB\R2012b\toolbox\readimx';
n_i =10; %Number of files
pixel_line = 460;
pixel_line2 = 462;%Pixel line to extract from bottom
Aver_Ray=zeros(520,688);
line=zeros(1,688);
line2=zeros(1,688);
B = readimx('2905_WI-DC\B00001_avg.IM7');
IB = (B.Data);
C = readimx('2905_He-DC\B00001_avg.IM7');
IC = (C.Data);
A = readimx('2905_WI-DC_\B00005.IM7');
IA= single(A.Data);
for i=1:n_i
%Reading file
file_name = '2905_WI-DC_\';
file_end = B00001(i);
A=readimx(strcat(file_name,file_end,'.IM7'));
IA= single(A.Data);
Signal=(IB-IC)'./(IA-IC)';
Fluctuation=std2(Signal);
result(i)=Fluctuation;
line(i) =line+Signal(pixel_line,:);
end
0 Comments
Accepted Answer
Mahdi
on 2 Jun 2014
I didn't look through the whole code, but based on the error, try the following:
line(i) =line(i)+Signal(pixel_line,:);
Basically, you've defined line (the first time) as a matrix (vector) with 688 values, but when you're telling it to line(i), you're telling the code to only fill one cell, but the right of the equal sign, line is defined as more than one value. I'm not sure what the definition of some of your variables (Signal, Fluctuation, etc...) and their size.
More Answers (0)
See Also
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!