storing values from a for loop into a new variable

1 次查看(过去 30 天)
for i = 1:length(row)
sol{i}
disp i
end
How can I store the values obtained (characters, not numbers) in a new variable?

采纳的回答

Stephen23
Stephen23 2018-12-12
N = numel(row);
C = cell(1,N);
for k = 1:N
C{k} = sol{k}
end
Or without a loop:
C = sol(1:N)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by