Finishing a calculation
Show older comments
Hey all, I've been analyzing lots of data recently, and thanks to everyone here, I've made great progress in learning Matlab and getting it to work. I have a new issue, but it should be resolved easily.
I've been running a loop to solve for a large amount of data imported from a csv file. I've been having success up until now. Here's the code:
data = csvread('data_d1_multi.csv');
assert (mod(size(data, 1), 1) == 0, ...
'Input data must have an integer multiple of 1 rows');
assert (size(data, 2) == 6, ...
'Input data must have exactly six columns.');
syms d1;
nsys = size(data, 1);
for k = 1 : nsys,
F = solve_d1_multi_eq(data((k-1) + (1:1), 1:end));
d(k, :) = solve(F);
end
fid=fopen('d1_multi_values.csv','w');
fprintf(fid,'%5.5f\n',d);
fclose(fid);
The function file in the above code brings in the data from the csv file and creates the function F, which is then solved, and then the loop reoccurs. It also defines d1 as a symbol. When I get to the fprintf step, however, Matlab won't write. Here is the error:
??? Error using ==> fprintf
Function is not defined for 'sym' inputs.
When I enter d into the command window, I get a list of "values," and these values are mathematical forms that, when I put them individually into the command window, solve into actual numbers. They look like so:
-(1255*log((117428176152016452228945106049267^(1/2)*(14665804317275172766575378895460*i - 2528628208763574832888728359811)^(1/2))/89293179851920557132557466203166 + 30173428047464645764307857899481/44646589925960278566278733101583 - (50832467171298678039874147590785*i)/89293179851920557132557466203166)*i)/(32*pi)
So, my questions:
1) How do I help Matlab output the values?
2) Why doesn't Matlab finish these calculations?
Thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!