Answered
regexp to capture only certain length of characters
str4='4-44g 4541 75872 a4cd stuvw'; regexpi([' ' str4 ' '],'(?<=[^0-9,a-z])[0-9,a-z]{4}(?=[^0-9,a-z])','match')

12 years ago | 0

Answered
Question regarding cell to string conversion
v={'E1'; 'E34'; 'E2';'E12'} n=max(cellfun(@numel,v)) w=cellfun(@(x) [x repmat(' ',1,n-numel(x))],v,'un',0) out=cell2mat(w) ...

12 years ago | 0

| accepted

Answered
Save data plot in GUI into a file, and may open it back?
h=plot(x,y) hgsave(h,'your_figure') To open your_figure hgload('your_figure')

12 years ago | 0

| accepted

Answered
How to keep the aspect ratio fixed when putting legend outside of plot
legend('Line 1','Line 2','Location','best')

12 years ago | 0

Answered
how can i put a label for columns in an array?
x=[1 5 8 0 6 1] header=genvarname(repmat({'x'},1,size(x,2)),'x') out=[header;num2cell(x)]

12 years ago | 0

Answered
how to transfer complex results into excel??
[a,b,c]=xlsread('file.xlsx') idx=cellfun(@isstr,c) c(idx)=cellfun(@str2num,c(idx),'un',0)

12 years ago | 0

Answered
Subtracting Matrices of Different Sizes by subtracting A(1) from all of B for all of A
A = [1 2 3 4 5 6 7 8 9]; B = [1 2 3 4 5 6 7 8 9 10 11 12] D=A' C=bsxfun(@minus, B,reshape(...

12 years ago | 1

| accepted

Answered
sum of two different data series
A=[0.50 1 0.25 1 0.80 2 0.10 1 0.60 1 0.50 2 0.25 2 0.50 2 0.4...

12 years ago | 3

| accepted

Answered
working with multiple matrix avoiding "for"
b=rand(55913,431);% b is your matrix a=permute(reshape(b',431,221,[]),[2 1 3]); variation=std(a,0,3)./mean(a,3); I test...

12 years ago | 1

| accepted

Answered
Save file to other directory other than current directory.
folder=C:\someother location file=fullfile(folder,your_file_name)

12 years ago | 0

| accepted

Answered
loops for different variables
p=[1e3 2e3 4e3] for k=1:numel(p) Kt=p(k); [t{k},Theta{k}]=ode45('As1_fn1',[t0,tf],ICS); end

12 years ago | 0

| accepted

Answered
Store results from for loop
Read this <http://www.mathworks.com/help/matlab/matrices-and-arrays.html>

12 years ago | 0

Answered
Multiple Text files to Labeled matrix/array
for k=1:100 outputString = sprintf('SR%d.txt', k); d=importdata(outputString) num{k}=d.data end

12 years ago | 0

Answered
How to reshape a vector without knowing the dimensions?
You needat least, know the first two dimensions, the use reshape(i,663x3127,[]) but this is not always possible, dependin...

12 years ago | 1

Answered
How can I use a string to call a matrix with the same name?
<http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F>

12 years ago | 1

| accepted

Answered
Create new variable if elements of different variables match in Matlab
*EDIT* a1=[A{:,1}]; b1=[B{:,1}]; c1=[C{:,1}]; n=numel(a1); out=cell(n,7); out(:,1:3)=A; ii=[ismember(a1,b1)' ismembe...

12 years ago | 1

| accepted

Answered
Check for repeated values in two cell arrays in matlab
a={ 701 452 8 407 31 1037 110 14 873 93 7985 881 20 16 69 9420 481 9 191 95} b={4220 308 118 464 24 7985 112 58 37 19 ...

12 years ago | 1

| accepted

Answered
How to build a set of matrices using the for loop
To store your 8 matrices, use cell array for i=2:9 coint{i}=[MainMatrix(:,1),MainMatrix(:,i)]; end celldisp(coin...

12 years ago | 0

| accepted

Answered
Why can't I reshape my 4-D array?
You are probably using data with different number of elements Try this ctf_dD=rand(1,40,60000,1); b=reshape(ctf_dD,1,40...

12 years ago | 0

Answered
matrix starting index from zero
Subscript indices must either be real positive integers or logicals you can work with your indices by adding 1 to them ...

12 years ago | 0

Answered
For loops - Textbook Example
When the condition is met, Matlab will exist the loop, which means ires will not be incremented. All instructions after break, ...

12 years ago | 0

| accepted

Answered
How can I avoid displaying "0" in my text box when cancel is pressed using UIGETDIR
k=uigetdir; if k==0; k=[]; end

12 years ago | 0

Answered
sum of an array and checking condition
You can use cumsum function v=[2 2 2 1 2 2 1 2 2 2]; idx=find(cumsum(v)>6,1)

12 years ago | 0

Answered
xlswrite: write values in different columns
You can save your data at the end of your iterations ni=10 % number f iterations out=zeros(1000,ni] for k=1:ni %...

12 years ago | 6

| accepted

Answered
output of indices column or row vector
Your question should be like this t = [-6 28; -1 3] [i,j] = find(t>0) i = 1 2 j = 2 ...

12 years ago | 0

Answered
Add zeros to some dates
fid = fopen('file.txt'); acyc = textscan(fid, '%s'); fclose(fid); w=cellfun(@(x) [repmat('0',1,6-numel(x)) x],acyc{:},'un'...

12 years ago | 0

| accepted

Answered
Convert text of multiple digits to numbers
A={' 123123123 ' ' 123798731 ' ' 234874343 '} str2double(A)

12 years ago | 0

| accepted

Answered
Matlab - rename a variable with sprintf and save it
Var2=sprintf('Name%s%s,LOC,Run) assignin('base',var2,var1)

12 years ago | 0

| accepted

Load more