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

 채택된 답변

Mahdi
Mahdi 2014년 6월 2일

0 개 추천

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.

댓글 수: 3

FAISAL
FAISAL 2014년 6월 2일
Hi, Thanks Mahdi. I tried it but it didnt work either.
Signal is result of a calculation which it is in a matrix of 520x688 fluctuation = the standard deviation of the signal, but the one that i want to save is from the 'Signal' which i have to take the row number 460 from every matrices, and save them into a matlab file.
Mahdi
Mahdi 2014년 6월 2일
What was the error that you got?
Mahdi
Mahdi 2014년 6월 2일
편집: Mahdi 2014년 6월 2일
Sorry, I also forgot that you need to use do this:
line(i,:)=line(i,:)+Signal(pixel_line,:);
Also, why are you adding line(i,:) to signal if it's just a row of zeros? Can't you just do this?
line(i,:)=Signal(pixel_line,:);

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2014년 6월 2일

편집:

2014년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by