Lists in matlab to store iterative data.

조회 수: 10 (최근 30일)
Nilesh Chaturvedi
Nilesh Chaturvedi 2018년 6월 8일
답변: Steven Lord 2018년 6월 8일
Hello!, I am new to Matlab so excuse me if my question is too stupid. I wanted to know if there is something like list to store dynamic data. Similar to dynamically allocated arrays in C?

채택된 답변

Aakash Deep
Aakash Deep 2018년 6월 8일
Hello Nilesh,
From your question I understand that you are trying to add a new value into your pre-defined vector. So for this you can just append the new value into the end of the vector, just like below
A = [A x]
where, A is your pre-defined vector and x is your new value.
Hope this helps :)
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 6월 8일
If you are putting a scalar onto the end of a vector, then the shortcut is
A(end+1) = x;

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

추가 답변 (2개)

Stephen Devlin
Stephen Devlin 2018년 6월 8일
I store dynamically generated data in cell arrays or tables all the time, can you show some of your code/data?
  댓글 수: 1
Nilesh Chaturvedi
Nilesh Chaturvedi 2018년 6월 8일
Its more like I am testing a method for many values and I am getting a quality score for each value and I have to store the quality store somewhere. At first, I was looking for a python dictionary where I can store key, value pairs, but then a list would also do, because the values are sorted and equidistant from each other.

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


Steven Lord
Steven Lord 2018년 6월 8일
The containers.Map object allows you to store key-value pairs.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by