Problem with Running a matlab code.

조회 수: 1 (최근 30일)
ALINA
ALINA 2014년 1월 27일
답변: Vartika Rao 2020년 10월 6일
The first time the code was run in matlab,I got a graph.But then the next time,with the same code they are showing either error or another graph.so i am not able to work further.I am using MATLAB R2012a.Can you please help me to solve this problem.
  댓글 수: 2
Amit
Amit 2014년 1월 27일
Please post your code here.
ALINA
ALINA 2014년 1월 27일
편집: Walter Roberson 2014년 1월 27일
Thank you.This is my code
clear
X=multibandread('EO1H1460512012064110KZ_L1T.dat',[3481,1091,155],'int16',0,'bil','ieee-le',{'Band','Direct',[1:13]});
S=decorrstretch(X);
spectrum=S(2000,500,:);
band=size(spectrum);
band=band(3);
for n=0:(band-1)
x(n+1)=(n*5)+1;
y(n+1)=spectrum(1,1,n+1);
end
plot(x,y)
xlabel('band no.')
ylabel('reflectance')
I have also attached the graph i have got the first time and the error i got the second time

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

답변 (3개)

Amit
Amit 2014년 1월 27일
After looking at the plots, the issue turns out to be memory issue. The first time, you used it, MATLAB could create the matrix. However the second time or whenever the error was there, there was insufficient memory avaialble to MATLAB to execute multibandread. Did you use different computers different times for running this code?
  댓글 수: 2
ALINA
ALINA 2014년 1월 27일
Thank you amit.But actually i used only my system for doing all this.
Amit
Amit 2014년 1월 27일
Okay. However, think this: To do a large matrix, MATLAB needs a contiguous block of memory. Sometimes, windows does not provide that much continuous block of memory and in those case you'll run into this error.
Check out the link, I added. This will probably help you.

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


Walter Roberson
Walter Roberson 2014년 1월 27일
Change the
clear
to
clear X
clf
and then you will probably be able to run it multiple times.

Vartika Rao
Vartika Rao 2020년 10월 6일
"I am getting an error on the execution of this file- ERROR-Unrecognized function or variable 'ReadData3D"
%%
%acquire sequences
[Vflair,infoF] = ReadData3D();
[VT1,infoT1] = ReadData3D();
[VT2,infoT2] = ReadData3D();
%rotate images for an esier comparing with true file
Vflair=rot90(Vflair);
VT1=rot90(VT1);
VT2=rot90(VT2);
%%
%select a slice of brain (for example 75th slice)
Vflair = mat2gray(Vflair);
Vf = Vflair(:,:,75);
VT1 = mat2gray(VT1);
Vt1 = VT1(:,:,75);
VT2 = mat2gray(VT2);
Vt2 = VT2(:,:,75);
%%
figure;
montage({Vf,Vt2,Vt1},'Size',[1 3]);
pause();
close all;

카테고리

Help CenterFile Exchange에서 MRI에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by