Interpolation values from a table
18 次查看(过去 30 天)
显示 更早的评论
Hi guys, i wonder if anyone can help me! Im trying to intepolate values from a table that i load on to matlab but i dont understand what is the thing that i am doing wrong, can someone help me? Here is my code:



I didnt put the whole code on here because i dont think it is necessary! Basically i got the areatemp1 file with has values for areas mach and temperatures and i want to interpolate to get a mach value after calculating a Area value. if anyone could help me, it would be great
4 个评论
Dheeraj Singh
2019-9-12
Please check the variable type of T.Area . You can print the variable to see if it is of expected type or not. You can refer to the documentation of interp1 to see the expected type of T.Area.
Hope this helps.
回答(1 个)
Jon
2019-9-12
编辑:Jon
2019-9-12
If T.area is a cell array, and maybe T.Mach is also a cell array you must first turn them into ordinary MATLAB vectors, (n by 1 or 1 by n arrays) before interpolating. So, for example you could do something like
area = cell2mat(T.Area)
Mach = cell2mat(T.mach)
machs = interp1(area,mach,dif);
or perhaps more compactly
machs = interp1(cell2mat(T.area),cell2mat(T.mach),dif)
6 个评论
Jon
2019-9-17
Did this answer your question? In the end what was causing the wrong number of arguments error?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!