passing a 3d matrix to a function

1 回表示 (過去 30 日間)
ABDUL
ABDUL 2018 年 2 月 9 日
コメント済み: ABDUL 2018 年 2 月 12 日
hi............. can anyone help how pass a 3d array/matrix to a function i have the input to the function is papro which is 2x32x2 , type is double, i need to pass m x n x p matrix. i am using ccdf as my function to plot the graph. i am getting the error message as Undefined function 'colon' for input arguments of type 'double' and attributes 'full 3d real'.
Error in ccdf (line 21)
range=min(x):step:max(x);
Error in mimo_pts (line 98)
[cy,cx]=ccdf(papro,0.1);

採用された回答

Geoff Hayes
Geoff Hayes 2018 年 2 月 9 日
Abdul - first, you didn't have to delete your previous question and repost. Just edit the existing one.
As for ccdf, are you using this https://www.mathworks.com/matlabcentral/fileexchange/33029-complementary-cumulative-distibution-function) from the File Exchange? I suspect that you are given that I observe the same error with some random input data. The problem is with the line
range=min(x):step:max(x);
in that min and max are returning multi-dimensional arrays rather than the presumably expected scalar values (see min for details on why it is behaving as it does). If you want the minimum or maximum across all elements in x, just replace the above line with
range=min(x(:)):step:max(x(:));
While this will prevent the error from occurring, I can't guarantee that it will provide you with the correct result.
  5 件のコメント
Walter Roberson
Walter Roberson 2018 年 2 月 10 日
As I have posted several times now, your zeros(N,(L-1)*N,ii) needs to be zeros(N,(L-1)*N,length(ii))
ABDUL
ABDUL 2018 年 2 月 12 日
@Walter- i have tried executing the code by giving length(ii) , it is executing the code for page 1 of multidimensional array but the code is not getting executed for the page 2 of multidimensional array. as i have posted the code in my previous question . i am trying to execute the code page by page and access the elements page by page.

サインインしてコメントする。

その他の回答 (1 件)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by