Loading a .mat fil into my gui edit box
이전 댓글 표시
Hi
Ive made a gui with alot of editboxes, and made a save button that saves the data I've put into the edixboxes, to a .mat fil.
The mat fil is a matrix due to the many edixboxes.
But now I want to make a load button.
load(uigetfile('*.mat','Select the MATLAB code file'));
This is what I have, but it doesn't load my data into the editboxes.. What more do I need to write? I have 40 editboxes.
댓글 수: 1
Rabia Butt
2012년 7월 26일
hey mikkel!
would you help me by telling how do you save the data you input in your editbox to a .mat file?????
I would appreciate your help! thanks!
채택된 답변
추가 답변 (1개)
Mikkel
2012년 7월 7일
0 개 추천
댓글 수: 22
Walter Roberson
2012년 7월 8일
Unfortunately my system is claiming it cannot find postimage.org even though I can google it. Anyhow, could you post the image somewhere else?
Walter Roberson
2012년 7월 8일
YourEditHandles = [handles.editbox1, handles.editbox2, handles.editbox3, handles.editbox4, handles.editbox5, handles.editbox6, handles.editbox7, handles.editbox8, handles.editbox9];
And if your actual handle names involve Editbox instead of editbox then use whatever you have, in order, so that the 5th entry in the vector corresponds to your "edit box 5"
Mikkel
2012년 7월 8일
Walter Roberson
2012년 7월 8일
Change YourEdithandles to YourEditHandles in the set()
Walter Roberson
2012년 7월 8일
for K = 1 : numel(fieldsvals2)
set( YourEditHandles2(K), 'String', num2str( fieldvals2(K) ) );
end
Mikkel
2012년 7월 8일
Walter Roberson
2012년 7월 8일
How do you initialize YourEditHandles5 ?
You only spoke before about having two sets of edit boxes, not five or more sets ?
Mikkel
2012년 7월 8일
Walter Roberson
2012년 7월 8일
Put a breakpoint at that line, and run the code. When the line is reached, at the command prompt, give the commands
size(YourEditHandles5)
ishandle(YourEditHandles5)
K
size(fieldvals5)
and let us know what it shows.
Also please show the code that constructs fieldvals5 and YourEditHandles5
Walter Roberson
2012년 7월 9일
I do not presently have access to MATLAB. I am trying to decide which new computer to buy, after which I will need to order a copy of MATLAB.
Mikkel
2012년 7월 9일
Walter Roberson
2012년 7월 9일
What do you want to put there?
if isnan(fieldvals(K))
set( YourEditHandles(K), 'String', {''} ); %or to suit
else
set( YourEditHandles(K), 'String', num2str(fieldvals(K)) );
end
Walter Roberson
2012년 7월 9일
An edit box has to have something even if that something is the empty string.
The code structure I show just above would detect NaN in the input matrix and make it show as the empty string in the empty box.
Mikkel
2012년 7월 9일
Walter Roberson
2012년 7월 9일
Use a vector, not a matrix. Especially not a matrix that cannot decide whether it is one entry per row or 7 entries per row.
Mikkel
2012년 7월 9일
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
