0

I'm having trouble using fprintf. I'm trying to print variables side by side. For example, the way it has to look like is A1 then another value. Then new line, A2 and another value. New line, A3 and another value from variable 'A' and so on.

f2 = 1:124;
fprintf(fileID,'A%f \t %f \n',f2',A);

This code prints:

A1 2
A3 4
A5 6

and so on. How can I fix this?

1 Answer 1

1

You could iterate through them all:

for i = 1:124
  fprintf(fileID,'A%f \t %f \n',f2(i),A(i))
end
Sign up to request clarification or add additional context in comments.

1 Comment

Perfect. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.