フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I tried debugging the code it works until it reaches line 31 (temp=pad...) i dont know what i am doing wrong but can u help me with this error it is indicated after the code

1 回表示 (過去 30 日間)
Talal
Talal 2013 年 11 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
close all clear all
load C:\Users\Traddadi\Desktop\biomed_img\project_2\rfdata\cystdata ri theta
fc=5e6; % center freq in Hz fs=5e7; % sampling freq in Hz r0=0.07; % focal depth in m dt=1/fs; xn=ri/1000; c=1540; % acoustic wave velocity in the medium in m/s t=2*r0/c; % time in
d = dir('*.mat'); % looks for .mat-Files for i = 1: 127 load(['rfline' num2str(i) '.mat']) for j= 1:128 tau(j)=(((xn(j).^2*cos(theta(i)).^2)/2*c*r0)-(xn(j).*sin(theta(i))./c)); end end
tau % notes delay =abs(tau)*fs; max_delay=max(delay); pad=zeros(8192,length(xn));
for i = 1: 128 rflines=sum(pr,2); temp=pad(rflines,delay(1,i),'post'); temp=pad(rflines,max_delay(1,i),'pre'); rfdata(:,i)=temp; end
figure, imagesc(abs(hilbert(rfdata))) colormap(gray)
when I run the code i have the following error:
??? Subscript indices must either be real positive integers or logicals.
Error in ==> test_bio_code_pj2 at 31 temp=pad(rflines,delay(1,i),'post');
  4 件のコメント
Laurent
Laurent 2013 年 11 月 1 日
Thanks Image Analyst, only now I realize that Talal was actually posting the code of test_bio_code_pj2. I was confused because I didn't see 31 lines.

回答 (1 件)

Iain
Iain 2013 年 11 月 1 日
Put a breakpoint in your code at line 31, and look in the memory of the function for a variable called pad. I suspect that you load in a variable with that name, so that when you attempt:
temp = pad(rflines,delay(1,i),'post');
That matlab identifies "pad" as a variable, then attempts to access it using the index " 'post' ", which is garbage.
padarray might be a better option than pad.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by