Extracting Data to a workspace
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Chris_WMS
el 14 de Oct. de 2020
Comentada: Chris_WMS
el 14 de Oct. de 2020
Hi, guys, I would like some help.
The coding below is a m-script file that I run to obtain an 'A' solution.
I would like to retrive the data into one workspace.
The table is the format that I expect to retrieve every variable in the for loop. Is there any method to write to obtain the results like the table?
(The first row is to show how it is arrange and it is not displayed in the workspace)
close all; clear all; clc;
cnt = 0;%count
for X=0:5
for Y=0:5
cnt=cnt+1;
A(cnt,:)=X+Y;
end
end
0 comentarios
Respuesta aceptada
Stephen23
el 14 de Oct. de 2020
The MATLAB approach:
>> [X,Y] = meshgrid(0:3,0:2);
>> A = X+Y;
>> M = [X(:),Y(:),A(:)]
M =
0 0 0
0 1 1
0 2 2
1 0 1
1 1 2
1 2 3
2 0 2
2 1 3
2 2 4
3 0 3
3 1 4
3 2 5
Más respuestas (0)
Ver también
Categorías
Más información sobre Whos en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!