Answered
Extract Variable from Filename?
file='sitename.yr.synth.daily.mat' idx=strfind(file,'.') site=file(1:idx(1)-1) %or file='sitename.yr.synth.daily.mat...

13 years ago | 0

Answered
Vertically concatenate fields with same names from different structures
I do not see how to do it without eval field={'x','y','z'} for ii=1:numel(field) d=[] for k=1:3 eval([...

13 years ago | 0

| accepted

Answered
what is wrong with my 'While' function
n=1; while n>1; You will never be in the loop Also, there is no variable T in your code To test if TT is equal ...

13 years ago | 0

Answered
Use UICONTROL for listbox
yourcell={'mass','velocity','time','acceleration','speed'} uicontrol('Style', 'listbox','Position',[100 100 200 200],... ...

13 years ago | 0

| accepted

Answered
Comparing Values from file to cell array
f=fopen('tes1.txt') line1=fgetl(f) res=[]; k=0; while ischar(line1) if ischar(line1) res =char(res,line1) i...

13 years ago | 0

| accepted

Answered
using FIND in 3D matrix
idx=find(arrayfun(@(x) isequal(A(:,:,x),B),1:size(A,3)))

13 years ago | 0

| accepted

Answered
Extract the first negative value in a matrix column
*Edit* out=arrayfun(@(x) min([ 0 A(find(A(:,x)<0,1),x)]),1:size(A,2))

13 years ago | 2

| accepted

Answered
Simulink model doesn't output the correct results for a ODE
The matrices in your simulink model are different from your script, in your simulink model set *Edit* regarding to Jan's rem...

13 years ago | 1

| accepted

Answered
Syntax Error: Unknown Function
You can tell us what is the value of gam?

13 years ago | 0

| accepted

Answered
importing a column of data from a text file
Import the data using data=dlmread('yourfilename.txt') Then choose the column you want data(:,2) % You can get...

13 years ago | 0

Answered
finding the first, second and third maxima in the signal
I suggest that you do it manually using the function <http://www.mathworks.com/help/matlab/ref/ginput.html ginput>

13 years ago | 0

Answered
HOW TO CHANGE MULTIPLE JPG TO PNG IMAGES
f=dir('Yourfolder\*.jpg'); fil={f.name}; for k=1:numel(fil) file=fil{k} new_file=strrep(file,'.jpg','.png') ...

13 years ago | 7

| accepted

Answered
How to get a variable slider in length?
set(handles.slider1,'Max',max_value) set(handles.slider1,'Min',min_value)

13 years ago | 0

Answered
Get value of a variable from one popupmenu1 function and use it in different popmenu2 function
You can use guidata function popupmenu1_Callback(hObject, eventdata, handles) b=get(handles.popupmenu1, 'value'); switch...

13 years ago | 0

| accepted

Answered
Variable input acceleration matrix
You can use a <http://www.mathworks.com/help/simulink/slref/switch.html switch> block and two constant block

13 years ago | 0

Answered
Read a text file containing an array of numbers and vectors
f=fopen('fic55.txt') line1=fgetl(f) res=[]; k=0; while ischar(line1) if ischar(line1) res =char(res,line1) ...

13 years ago | 1

| accepted

Answered
How can I modify the Y-axis of an existing plot in a .fig file?
plot(t,y*1000)

13 years ago | 0

Answered
divided differences command in matlab
Look at this <http://www.mathworks.com/matlabcentral/fileexchange/28215-newtons-method-for-divided-differences/content/divdiff....

13 years ago | 0

Answered
how can i combine two different matrics with different size become one matric that fixed size
C=zeros(1,15); C(1:numel(A)+numel(B))=[A B]

13 years ago | 1

| accepted

Answered
Divide an array in areas based on its values
a=[1 1 1 1 1 1 12 10 1 1 1 1 1 11 12 1 1 1 2 3 ] idx=find(a==1) e=[diff(idx) 100] f=find(e~=1) ff=idx(f) ii1=[idx(1) idx(...

13 years ago | 0

| accepted

Answered
Input matrix for scenarios
A=[1,1,1;0,1,1]

13 years ago | 0

Answered
GUI : change edit text to predefined number by selecting from dropdown menu
It's better to use an uitable and make its cells editable

13 years ago | 0

Answered
Sum of cell array column
oout=sum(cellfun(@double,summary3(:,11)))

13 years ago | 5

| accepted

Answered
How can use embedded matlab function block as inherited ?
You can pass the output of your embedded function through a <http://www.mathworks.com/help/simulink/slref/zeroorderhold.html zoh...

13 years ago | 0

| accepted

Answered
How to store images in a single array or matrix
f=dir('*.jpg') files={f.name} for k=1:numel(files) Im{k}=imread(files{k}) end

13 years ago | 8

Answered
Plotting normal curve and a third order polynomial
The problem is this line best_y=-0.0030*x.^2+0.0851*x+691891; It should be best_y=-0.0030*x.^2+0.0851*x+69.1891; ...

13 years ago | 0

Answered
Plotting data from a loop
Use a(k) and b(k)

13 years ago | 0

Answered
How to do a group by in matlab
data=[10 1 2 3; 11 4 5 6;10 0 20 30; 11 4 5 6; 12 7 8 9; 17 40 50 60] lookfor=[10;11]; a=arrayfun(@(x) data(find(data(:,1)==...

13 years ago | 0

| accepted

Answered
How to track indices of a matrix after a transformation
A = [1 2 3; 4 5 6;7 8 9] idx=1:numel(A) % the index of A B=rot90(A); idx1=reshape(idx,size(A)) new_idx=rot90(idx1); new_...

13 years ago | 0

Answered
Vector input/output for embedded matlab function
You can use a matrix as an input or output, there is no syntax for that, just write your function and use those inputs.

13 years ago | 0

Load more