print value to workspace

조회 수: 15 (최근 30일)
Esra Demirbilek
Esra Demirbilek 2022년 4월 6일
답변: Prince Kumar 2022년 4월 11일
Hello everyone
With this code, I print the result, new_m, Yy_new values ​​for each k value in the command window. But the workspace has only the last k values.
What I want to do is; For each value of k, the result in the workspace should also contain the values ​​of the new_m, Yy_new matrices.
This is my code:
for k= 1:10
b{k}=birfazson(1,birfazson(2,:)==k);
resultt = birfazson(1,birfazson(2,:) == k).'
new_m = [resultt birincisure(k,resultt).']
proctime= [birincisure(k,resultt)].' ;
Yy = zeros(numel(proctime),3);
Yy(:,1) = proctime(:,1);
Xx = cumsum(Yy(:,1));
Yy(2:end,2) = Xx(1:end-1);
Yy(:,3) = Xx(:);
Yy_new=[new_m(:,1) Yy]
end
Thanks advance

답변 (1개)

Prince Kumar
Prince Kumar 2022년 4월 11일
Hi,
It is the expected behaviour where MATLAB save the latest value in the workspace.
However, if you want to save all the values of the variables you can append the values in an array/matrix and access them accordingly.
Please refer to the following answers on how to append in the array:
Hope this helps!!

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by