Storing values using csapi (spline functin)

5 ビュー (過去 30 日間)
Mauricio Marulanda
Mauricio Marulanda 2012 年 2 月 24 日
編集済み: dpb 2013 年 10 月 24 日
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
Sean de Wolski 2012 年 2 月 24 日
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 件のコメント
Sean de Wolski
Sean de Wolski 2012 年 2 月 24 日
If called correctly it will take a cell array:
doc csapi
Mauricio Marulanda
Mauricio Marulanda 2012 年 2 月 24 日
according to the document as long as "if x is sequences x1, ..., xm, of lengths n1, ..., nm respectively, then y is expected to be an array, of size [n1,...,nm]"
then why st{1} = csapi({a,b,c,d},y); will not work if
x is a cell array and
y is pretty much (y1..length(a), y2..length(b), y3..length(c), y4..length(d))

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


Mauricio Marulanda
Mauricio Marulanda 2012 年 2 月 27 日
I believe based on the comments the best way to do this: Come up with something like this. x = f(a,b,c,d) %refering to my previous code Where x is a unique function of a,b,c,d. y = [y1 y2 ... length(x)] %length(x) = length(a)*len(b)*len(c)*len(d) out = csapi(x,y)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by