Email: helpdesk@telkomuniversity.ac.id

This Portal for internal use only!

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Categories
  • Microsoft
    • Microsoft Apps
    • Office
    • Operating System
    • VLS
    • Developer Tools
    • Productivity Tools
    • Database
    • AI + Machine Learning
    • Middleware System
    • Learning Services
    • Analytics
    • Networking
    • Compute
    • Security
    • Internet Of Things
  • Adobe
  • Matlab
  • Google
  • Visual Paradigm
  • WordPress
    • Plugin WP
    • Themes WP
  • Opensource
  • Others
More Categories Less Categories
  • Get Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • My Account
    • Download
    • Cart
    • Checkout
    • Login
  • About Us
    • Contact
    • Forum
    • Frequently Questions
    • Privacy Policy
  • Forum
    • News
      • Category
      • News Tag

iconTicket Service Desk

  • My Download
  • Checkout
Application Package Repository Telkom University
All Categories

All Categories

  • IBM
  • Visual Paradigm
  • Adobe
  • Google
  • Matlab
  • Microsoft
    • Microsoft Apps
    • Analytics
    • AI + Machine Learning
    • Compute
    • Database
    • Developer Tools
    • Internet Of Things
    • Learning Services
    • Middleware System
    • Networking
    • Operating System
    • Productivity Tools
    • Security
    • VLS
      • Office
      • Windows
  • Opensource
  • Wordpress
    • Plugin WP
    • Themes WP
  • Others

Search

0 Wishlist

Cart

Menu
  • Home
    • Download Application Package Repository Telkom University
    • Application Package Repository Telkom University
    • Download Official License Telkom University
    • Download Installer Application Pack
    • Product Category
    • Simple Product
    • Grouped Product
    • Variable Product
    • External Product
  • All Pack
    • Microsoft
      • Operating System
      • Productivity Tools
      • Developer Tools
      • Database
      • AI + Machine Learning
      • Middleware System
      • Networking
      • Compute
      • Security
      • Analytics
      • Internet Of Things
      • Learning Services
    • Microsoft Apps
      • VLS
    • Adobe
    • Matlab
    • WordPress
      • Themes WP
      • Plugin WP
    • Google
    • Opensource
    • Others
  • My account
    • Download
    • Get Pack
    • Cart
    • Checkout
  • News
    • Category
    • News Tag
  • Forum
  • About Us
    • Privacy Policy
    • Frequently Questions
    • Contact
Home/Matlab/How do I print one value on one row and another on the next

How do I print one value on one row and another on the next

PuTI / 2025-01-30
How do I print one value on one row and another on the next
Matlab News

So I have a matrix which I am trying to print into a file so that one row has one value the next row a different and so one. The first collum in each row should alternate between B and N, which it is doing, however the rest of the row values are the same. For example here is the first four rows of the printed file :
B 55.31897464 3.07237728 -1002.88631401
N 55.31897464 3.07237728 -1002.88631401
B 53.43739489 3.94977174 -1001.67387801
N 53.43739489 3.94977174 -1001.67387801

Instead of the N row being the same as the B row I would like the file to be printed as:
B 55.31897464 3.07237728 -1002.88631401
N 53.43739489 3.94977174 -1001.67387801
Attatched is my code :
for i = 1:2:size(unit,1)
fprintf(fid_1, ‘%s %10.8f %10.8f %10.8frn’,’B’,unit(i,1),unit(i,2),unit(i,3)); %print boron atoms
fprintf(fid_1, ‘%s %10.8f %10.8f %10.8frn’,’N’,unit(i,1),unit(i,2),unit(i,3)); %print nitrogen atoms
endSo I have a matrix which I am trying to print into a file so that one row has one value the next row a different and so one. The first collum in each row should alternate between B and N, which it is doing, however the rest of the row values are the same. For example here is the first four rows of the printed file :
B 55.31897464 3.07237728 -1002.88631401
N 55.31897464 3.07237728 -1002.88631401
B 53.43739489 3.94977174 -1001.67387801
N 53.43739489 3.94977174 -1001.67387801

Instead of the N row being the same as the B row I would like the file to be printed as:
B 55.31897464 3.07237728 -1002.88631401
N 53.43739489 3.94977174 -1001.67387801
Attatched is my code :
for i = 1:2:size(unit,1)
fprintf(fid_1, ‘%s %10.8f %10.8f %10.8frn’,’B’,unit(i,1),unit(i,2),unit(i,3)); %print boron atoms
fprintf(fid_1, ‘%s %10.8f %10.8f %10.8frn’,’N’,unit(i,1),unit(i,2),unit(i,3)); %print nitrogen atoms
end So I have a matrix which I am trying to print into a file so that one row has one value the next row a different and so one. The first collum in each row should alternate between B and N, which it is doing, however the rest of the row values are the same. For example here is the first four rows of the printed file :
B 55.31897464 3.07237728 -1002.88631401
N 55.31897464 3.07237728 -1002.88631401
B 53.43739489 3.94977174 -1001.67387801
N 53.43739489 3.94977174 -1001.67387801

Instead of the N row being the same as the B row I would like the file to be printed as:
B 55.31897464 3.07237728 -1002.88631401
N 53.43739489 3.94977174 -1001.67387801
Attatched is my code :
for i = 1:2:size(unit,1)
fprintf(fid_1, ‘%s %10.8f %10.8f %10.8frn’,’B’,unit(i,1),unit(i,2),unit(i,3)); %print boron atoms
fprintf(fid_1, ‘%s %10.8f %10.8f %10.8frn’,’N’,unit(i,1),unit(i,2),unit(i,3)); %print nitrogen atoms
end matrix manipulation, odd, even MATLAB Answers — New Questions

​

Tags: matlab

Share this!

Related posts

How do I find the corner points of an mask
2025-05-09

How do I find the corner points of an mask

Upper limit on the number of UIAxes children allowed
2025-05-09

Upper limit on the number of UIAxes children allowed

Running Simulink Online on Selfhosted Docker MATLAB Online Instance
2025-05-09

Running Simulink Online on Selfhosted Docker MATLAB Online Instance

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

Categories

  • Matlab
  • Microsoft
  • News
  • Other
Application Package Repository Telkom University

Tags

matlab microsoft opensources
Application Package Download License

Application Package Download License

Adobe
Google for Education
IBM
Matlab
Microsoft
Wordpress
Visual Paradigm
Opensource

Sign Up For Newsletters

Be the First to Know. Sign up for newsletter today

Application Package Repository Telkom University

Portal Application Package Repository Telkom University, for internal use only, empower civitas academica in study and research.

Information

  • Telkom University
  • About Us
  • Contact
  • Forum Discussion
  • FAQ
  • Helpdesk Ticket

Contact Us

  • Ask: Any question please read FAQ
  • Mail: helpdesk@telkomuniversity.ac.id
  • Call: +62 823-1994-9941
  • WA: +62 823-1994-9943
  • Site: Gedung Panambulai. Jl. Telekomunikasi

Copyright © Telkom University. All Rights Reserved. ch

  • FAQ
  • Privacy Policy
  • Term

This Application Package for internal Telkom University only (students and employee). Chiers... Dismiss