Info

This question is closed. Reopen it to edit or answer.

Save inputs from a GUI into 3D matrix (always at the last position)

1 view (last 30 days)
%prompt command for k number and length
prompt = {'k0:','Length:'};
dlg_title = 'Straight Duct specs';
num_lines = 1;
SDelements = {'0','0'};
Straightduct = inputdlg(prompt,dlg_title,num_lines,SDelements)
%insert values in function
sizeStorageMatrix=size(StorageMatrix); %get size of the storage matrix
dimT=sizeStorageMatrix(1,3); %take the number of matrices
if dimT==1
StorageMatrix(1:2,1:2,1)=straight_duct(str2num(SDelements{1}), str2num(answer{2}), Mach_Frange(1,1))
else
StorageMatrix(1:2,1:2,dimT+1)=straight_duct(str2num(SDelements{1}), str2num(answer{2}), Mach_Frange(1,1))
end
% code
end
This is my code for a GUI to create a 2by2 matrix which i'd like to save in a 3D matrix. This matrix should be saved in the first position of the 3D matrix and when i push the button more it should be saved in that corresponding position in the 3D matrix. I have, however, no idea to do this. Currently i declared my StorageMatrix at the beginning but i get an error when i run: variable storagematrix is not recognized. I've googled, i've run through the matlab help files but i can't seem to find my solution. Any hints?
kind regards,
Youri
  2 Comments
Walter Roberson
Walter Roberson on 26 Nov 2013
You do not show any initialization for StorageMatrix, so you would not be able to take size() of it.
Youri
Youri on 29 Nov 2013
i know the code isn't perfect, ive initialized storageMatrix in the openingfnc. I just have no idea on how to access and store Guidata as a 3D matrix. Like i said, i've looked everywhere but not being an experienced programmer i don't have the insight in all the words and ways of the code.

Answers (0)

Community Treasure Hunt

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

Start Hunting!