append array of 1xn in mat file and as a result it should be look like kxn. k=3

조회 수: 2 (최근 30일)
I want to append array of 1xn which is having values of each iteration into mat file. eg if iteration=3 and data=1xn then i want that after iterations i will get mat file containing values like 3 rows and n columns. this mat file is inside a loop. I dont want to overwrite the values. in present code it is overwriting it.
thank you.
  댓글 수: 2
Stephen23
Stephen23 2018년 10월 25일
편집: Stephen23 2018년 10월 25일
Note that save's -append option is very badly named: it should really be named -overwrite or something similar, because it does not "append" data to an existing variable in the .mat file, it actually completely overwrites any existing variable of the same name.

댓글을 달려면 로그인하십시오.

채택된 답변

Stephen23
Stephen23 2018년 10월 25일
편집: Stephen23 2018년 10월 25일
You will have to do one of these:
  1. on each iteration load the data, concatenate, then save the data.
  2. use matfile.
  3. collect all of the data into one array, then save it all at once after the loop.
I recommend the third option (because it is the neatest and most efficient). Use matfile for very large data sets.
  댓글 수: 7
N/A
N/A 2018년 10월 25일
And there is also another problem. gprofits is coming from another .m file. And inside for loop gprofits appending values but if I change the size of gprofits to 1xn and if profits is of size 1xk where k<n then due to column numbers are not same it gives an error. Help me to resolve these problems. Thank you
N/A
N/A 2018년 10월 25일
the problem has resolved. Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품


릴리스

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by