フィルターのクリア

is there a way to go to the line above using fprintf function ?

5 ビュー (過去 30 日間)
Reema Alhassan
Reema Alhassan 2018 年 7 月 13 日
編集済み: Diwakar 2018 年 7 月 13 日
I'm writing on a csv file and I'm writing column by column for example here :
for i = 1 : length(col)
fprintf( fid, '%s\n', matrix{i});
end
I used this to make new line after each iteration I need to go to the same place before entering the loop
for example the output after the loop in csv will be 1 22 33 45 6 8 9 I need the pointer to go back to element 1 because what I need to do is to make another column near this column does anyone know how to do this?
Thank you

回答 (1 件)

Diwakar
Diwakar 2018 年 7 月 13 日
編集済み: Diwakar 2018 年 7 月 13 日
Okay so your idea is to move the cursor to a different part of your file after a write job. So, for this I would suggest you to look into the ftell function of MATLAB. The link to the documentation is : https://www.mathworks.com/help/matlab/ref/ftell.html?searchHighlight=ftell&s_tid=doc_srchtitle
This function will give you the current location of the cursor after the first write. Then you can use the fseek function to move the cursor to the desired location. The documentation for which is : https://www.mathworks.com/help/matlab/ref/fseek.html?searchHighlight=ftell&s_tid=doc_srchtitle
Hope this helps Cheers!

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by