Answered
Can't find the max of the plot
You need to use <http://www.mathworks.com/help/fixedpoint/ref/rdivide.html right array divide>, not <https://www.mathworks.com/h...

10 years ago | 1

| accepted

Answered
to select consecutive more than one column in matlab having difference
Sort the indices to get consecutive columns adjacent to each other: idx = sort([86:90:1800,87:90:1800,88:90:1800,89:90:1800,...

10 years ago | 0

| accepted

Answered
Matrix manipulation: Changing Diagonal values
>> S = randi(9,3,5) S = 4 3 9 4 4 6 4 2 2 9 6 1 1 5 ...

10 years ago | 0

| accepted

Answered
adding a value until a particular value
>> stp = 0.52; % step >> ini = [1,4,2,0]; % initial value >> mxv = [3,7,4,3]; % max value >> num = 10; % number of ro...

10 years ago | 2

| accepted

Answered
How to for loop through variables with two columns
Welcome to using MATLAB! The basic data type of MATLAB is the array. In fact every numeric variable is an array: it might be sca...

10 years ago | 1

| accepted

Answered
Converting cell to 3 dimensional matrix
If |C| is your cell array: cell2mat(permute(C,[1,3,2])) or cell2mat(reshape(C,1,1,[])) or cat(3,C{:})

10 years ago | 5

| accepted

Answered
cd frames; this command is showing error.. Kindly help ???
The best solution (fastest, most robust, easiest to debug) is to use <https://www.mathworks.com/help/matlab/ref/fullfile.html |f...

10 years ago | 1

Answered
3D matrix to Video
It is easy to use <http://www.mathworks.com/help/matlab/ref/getframe.html |getframe|> and <http://www.mathworks.com/help/matlab/...

10 years ago | 1

| accepted

Answered
Reference .mat variable name after loading
Never |load| into the workspace directly, always |load| into a structure. Then your task is also much simpler, because it is eas...

10 years ago | 2

| accepted

Answered
compare two strings of cell array at different length and replace the existing string with a new set of strings
Use <https://www.mathworks.com/help/matlab/ref/regexprep.html |regexprep|> and this task is simple: >> A = {'apple';'ant';'...

10 years ago | 1

| accepted

Answered
How to use eval in parfor
Instead of creating numbered field names simply use a <http://www.mathworks.com/help/matlab/matlab_prog/access-multiple-elements...

10 years ago | 2

Answered
Extracting values from an array which correspond to values from another array
Read these: <https://www.mathworks.com/help/matlab/math/matrix-indexing.html> <http://blogs.mathworks.com/steve/2008/01/28...

10 years ago | 0

| accepted

Answered
How to use ismember in a cell array?
>> A = {[1,2,3],[3,4,5,6];[7,8],[9,1,2,3,4];[5],[6,7,8,9]}; >> B = 1; >> C = cellfun(@(a)a~=B,A,'Uni',0); >> D = cell...

10 years ago | 1

Answered
How to get a y-z; x table from a x-y; z Table Data?
One solution using <https://www.mathworks.com/help/matlab/ref/triscatteredinterp.html TriScatteredInterp>: >> X = [1,2,3,4,...

10 years ago | 1

| accepted

Answered
Calling user functions recursively
Why not just put the functions into a cell array, then this is trivial: >> C = {@rand,@()randi(9,1),@()randi([10,20],1)}; ...

10 years ago | 0

Answered
Extract data from nested structure and save in dynamically named cell
This is easy without dynamically named variables. Here is an example of how to use <https://www.scipy.org/ |scipy|> to access a...

10 years ago | 1

Answered
split a row into 2 rows
opt = {'CollectOutput',true}; inp = '%s%s%q%*d%*d%s%*q%*d%*d'; out = '%s\t%s\t%s\t%s\n'; f1d = fopen('temp1.txt','rt'...

10 years ago | 0

| accepted

Answered
Interpolation between multi curves
Use one of the interpolation tools for scattered data: <https://www.mathworks.com/help/matlab/scattered-data-interpolation.ht...

10 years ago | 1

| accepted

Answered
Is it better to use the dimensional cat function(s) versus using brackets?
I think the answer is "the one that make the code easiest to understand". Why is this the answer? Because: # commands like...

10 years ago | 2

Answered
How to add leading zeros in certain elements of an array?
Simple solution without converting to numeric or using |regexp|: >> C = strsplit('2 25 3 24'); >> sprintf('%02s ',C{:}) ...

10 years ago | 0

| accepted

Answered
Data is not saving to the workspace
Thank you for the file. What did I learn from the actual data file: that it is not _"composed of a single row"_, but in fact the...

10 years ago | 1

| accepted

Answered
how do i make my function accept filename as input ?
Change this line so it uses the variable |filename| instead of the string |'filename'|: data = xlsread(fileName);

10 years ago | 1

| accepted

Answered
How to back interpolation to find x from z and y?
This is easy with <https://www.mathworks.com/help/matlab/ref/interp2.html |interp2|> and <https://www.mathworks.com/help/matlab/...

10 years ago | 2

| accepted

Answered
How displayin a number with its subscript ?
legend('h=h_s0','h=2h_s0') See the |interpreter| option in the <https://www.mathworks.com/help/matlab/ref/legend.html |legen...

10 years ago | 0

| accepted

Answered
Is their any way to load only selected fields from a saved structure array.
*Method* Make sure you <https://www.mathworks.com/help/matlab/ref/save.html |save|> the structure array using the |'-struct'|...

10 years ago | 0

Answered
Input Arguments for Callback Function in a listener
If you do not need to use those inputs, then define your function using input placeholders: function updategui2(~,~) <htt...

10 years ago | 0

| accepted

Answered
How do I use use logical relations on a character array?
>> a = {'cat';'dog';'hamster';'shark';'duck';'bat'}; >> a(cellfun('length',a)>3) ans = 'hamster' 'shark' ...

10 years ago | 0

| accepted

Answered
How can I interpolate/ curve-fit 1D scattered data?
Some fitted curves allow the end point slopes to be specified, e.g. <https://www.mathworks.com/help/curvefit/csape.html |csape|>...

10 years ago | 0

| accepted

Answered
Hello, how can i remove zero from an array and leave the array in the same form? thanks
*Edit 20170214: added comments as requested* >> A = [1,0,2,6,0;0,3,4,0,0;5,0,2,7,4] A = 1 0 2 6 0 ...

10 years ago | 2

| accepted

Answered
How do you change bases without dec2base, etc.?
*Method one: |num2str|* (does not work with decimal digits): >> N = 23; >> vec = num2str(N)-'0' vec = 2 3...

10 years ago | 0

| accepted

Load more