MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Ty on 10 Oct 2013

I am working filling a matrix and I have the prior error. See the following:

function [MDA_matrix] = MDA_calc_V3(dmat,E_abs_matrix,timeofmeasu,sum_ROI,BACKGTime,f) box_loc = 0;

num_x = size(dmat,1); num_y = size(dmat,2); tot_box = size(dmat,3);

MDA_matrix = zeros(num_x,num_y,tot_box);

for i=1:tot_box for j=1:num_x for k=1:num_y %for i=1:x_num % for j=1:y_num %% INTERMEDIATE CALCULATIONS box_loc=box_loc+1; sqrt_sum_ROI=sqrt(sum_ROI(box_loc)); sqrt_BACKGTime=sqrt(BACKGTime); rate = sum_ROI(box_loc)/BACKGTime; pm_rate= sqrt_sum_ROI/BACKGTime; expected_value= rate*timeofmeasu; pm_expected_value=pm_rate*timeofmeasu; N_d=(4.65*sqrt(expected_value))+2.71; %% MDA CALCULATION E_abs = E_abs_matrix(j,k,i); %MDA_matrix(j,k,i) = N_d /(f * E_abs_matrix(j,k,i) * timeofmeasu); MDA_matrix(j,k,i) = N_d /(f * E_abs * timeofmeasu); %% end end end end

MDA_matrix is a 5x6x30 as E_abs_matrix, and dmat.

Any help.... thanks

Assignment has more non-singleton rhs dimensions than non-singleton subscripts

Error in MDA_calc_V3 (line 27) MDA_matrix(j,k,i) = N_d /(f * E_abs * timeofmeasu);

Error in MDA_calc_All_cells_V2 (line 164) [MDA_matrix] = MDA_calc_V3(dmat,E_abs_matrix,timeofmeasu,sum_ROI,BACKGTime,f);

Any help.... thanks

NO CLUE!!!

*No products are associated with this question.*

Answer by Walter Roberson on 10 Oct 2013

Please tell is size() of each of the input variables.

And at the command prompt give the command

dbstop if error

and then run your program. When it stops, tell it to display size() of N_d, F, and timeofmeasu

The error is telling you that you are trying to assign a vector of values into a single location.

## 0 Comments