Storing values using csapi (spline functin)
古いコメントを表示
I have been trying to use csapi. This command will work: x = [0 1 2 3]; y = [0 1 2 3]; csapi(x,y); However, I am trying to let x be a cell array. x = {[0 1 2 3] [0 1 2 3]}; y = [0 1 2 3]; Basically I want my "x" to be a table with different values. csapi(x,y); will not work for this case. Is this possible? I appreciate any help.
回答 (2 件)
Sean de Wolski
2012 年 2 月 24 日
0 投票
Why not just use a for-loop?
Or you coudl write a wrapper function around csapi that uses a for-loop internally but allows you to call it with a cell array.
Just my $0.02
11 件のコメント
Mauricio Marulanda
2012 年 2 月 24 日
Sean de Wolski
2012 年 2 月 24 日
post the full code of what you tried, it should be something like this:
C = your cell a cell arrasy
for ii = 1:length(C)
result{ii} = csapi(C{ii},y)
end
Mauricio Marulanda
2012 年 2 月 24 日
Sean de Wolski
2012 年 2 月 24 日
Still not going to work because csapi doesn;t want cell arrays!
I would recommend writing
out = csapiCell(Cx,y)
for ii = length(Cx):-1:1
out{ii} = csapi(Cx{ii},y);
end
Sean de Wolski
2012 年 2 月 24 日
save those four lines of code as csapiCell somewhere on the MATLAB path.
Mauricio Marulanda
2012 年 2 月 24 日
Mauricio Marulanda
2012 年 2 月 24 日
Sean de Wolski
2012 年 2 月 24 日
csapiCell the four lines of code I wrote above, if saved as an *.m file will be a wrapper that calls csapi with the contents of each cell. and returns a cell.
Mauricio Marulanda
2012 年 2 月 24 日
Sean de Wolski
2012 年 2 月 24 日
If called correctly it will take a cell array:
doc csapi
Mauricio Marulanda
2012 年 2 月 24 日
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!