Matlab coding
古いコメントを表示
clear all; clc;clf;
for k=1:5;
cos_el=R*cos(Elev);
asin_x=asin(cos_el);
cos_y=cos(asin_x);
vtec=stec.*(cos_y);
gistm =[ut, vtec];
TV_A{k}=ut;
L(k)=length(ut);
end
Following my coding. So i have 5 ut data and 5 vtec data. I need to find highest length of ut seems i have 5 ut data. then the highest length of ut data need to be in the first column in a new .mat form and following up by the other 5 vtec data. the 5 vtec data have to follow according the highest length of ut and seems the vtec data dimension are not same it must filled up with NaN or 0.
Comment on this Question
2 件のコメント
Andrei Bobrov
2012 年 4 月 26 日
duplicate
Walter Roberson
2012 年 4 月 26 日
duplicate is at http://www.mathworks.com/matlabcentral/answers/36600-how-to-find-the-maximum-length-between-few-cell-arrays
回答 (1 件)
Andrei Bobrov
2012 年 4 月 26 日
Let Ut - cell array 1 x 5 , contains column vectors with size n(k) x 1, for k = 1:5.
Vtec - cell array 1 x 5, contains vector m x 1, here all m <= max(n).
e.g. data:
Ut = arrayfun(@(ii)ii*ones(randi(10),1),1:5,'un',0);
Vtec = arrayfun(@(ii)ii*ones(randi(6),1),1:5,'un',0);
% solution
n = max(cellfun('length',Ut));
out = cellfun(@(x)[x;nan(n-numel(x),1)],Vtec,'un',0);
8 件のコメント
Vicky
2012 年 4 月 26 日
Andrei Bobrov
2012 年 4 月 26 日
use 'randint'? read help for this is function
Vicky
2012 年 4 月 26 日
Andrei Bobrov
2012 年 4 月 26 日
I do not understand the problem, give a numerical example
Vicky
2012 年 4 月 27 日
Walter Roberson
2012 年 4 月 27 日
Is that an example of the input data or the output data?
Vicky
2012 年 4 月 27 日
Andrei Bobrov
2012 年 4 月 27 日
Give the input data in numerical form as A1 = {[4 5 8 6] ', [8 6 9 1]'} and so on, and the corresponding output
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!